Skip to content

Commit 6e5ce4f

Browse files
committed
workbench_config() -> cloud_config()
1 parent 4271f31 commit 6e5ce4f

File tree

7 files changed

+57
-42
lines changed

7 files changed

+57
-42
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export(.flat)
2626
export(.progress)
2727
export(.stop)
2828
export(call_mirai)
29+
export(cloud_config)
2930
export(cluster_config)
3031
export(collect_mirai)
3132
export(daemon)
@@ -58,7 +59,6 @@ export(status)
5859
export(stop_cluster)
5960
export(stop_mirai)
6061
export(unresolved)
61-
export(workbench_config)
6262
importFrom(nanonext,"opt<-")
6363
importFrom(nanonext,.advance)
6464
importFrom(nanonext,.context)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#### New Features
44

5-
* Adds `workbench_config()` to launch remote daemons using the default-configured Kubernetes or traditional cluster on Posit Workbench.
5+
* Adds `cloud_config()` to launch remote daemons using a cloud / cloud-based managed platform. Currently supports Posit Workbench.
66

77
# mirai 2.4.1
88

R/launchers.R

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -447,28 +447,37 @@ cluster_config <- function(
447447
list(command = "/bin/sh", args = args, rscript = rscript, quote = NULL)
448448
}
449449

450-
#' Workbench Remote Launch Configuration
450+
#' Cloud Remote Launch Configuration
451451
#'
452-
#' Generates a remote configuration for launching daemons using the default
453-
#' configured Kubernetes or traditional cluster in Posit Workbench.
452+
#' Generates a remote configuration for launching daemons via cloud /
453+
#' cloud-based managed platforms.
454+
#'
455+
#' @param platform \[default "posit"\] character name of the platform
456+
#' (case-insensitive). Currently the only option is "posit" to use the Posit
457+
#' Workbench launcher.
454458
#'
455459
#' @inherit remote_config return
456460
#'
457461
#' @seealso [ssh_config()], [cluster_config()], and [remote_config()] for other
458-
#' remote launch configurations.
462+
#' types of remote launch configuration.
459463
#'
460464
#' @examples
461-
#' tryCatch(workbench_config(), error = identity)
465+
#' tryCatch(cloud_config(), error = identity)
462466
#'
463467
#' \dontrun{
464468
#'
465-
#' # Launch 2 daemons using the Workbench default:
466-
#' daemons(n = 2, url = host_url(), remote = workbench_config())
469+
#' # Launch 2 daemons using the Posit Workbench default:
470+
#' daemons(n = 2, url = host_url(), remote = cloud_config(platform = "posit"))
467471
#' }
468472
#'
469473
#' @export
470474
#'
471-
workbench_config <- function() {
475+
cloud_config <- function(platform = "posit") {
476+
switch(
477+
tolower(platform),
478+
posit = TRUE,
479+
stop(._[["platform_unsupported"]])
480+
)
472481
get_info <- .subset2(rstudio(), ".rs.api.launcher.getInfo")
473482
cluster <- get_info()[["clusters"]][[1L]]
474483
list(name = cluster[["name"]], image = cluster[["defaultImage"]])

R/mirai-package.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
n_zero = "the number of daemons must be zero or greater",
8484
not_found = "compute profile `%s` not found",
8585
numeric_n = "`n` must be numeric, did you mean to provide `url`?",
86-
rstudio_api = "workbench launcher requires a Posit Workbench environment",
86+
platform_unsupported = "`platform` is currently not supported",
87+
rstudio_api = "cannot be used outside of a Posit Workbench environment",
8788
sync_daemons = "mirai: initial sync with daemon(s) [%d secs elapsed]",
8889
sync_dispatcher = "mirai: initial sync with dispatcher [%d secs elapsed]",
8990
within_map = "cannot create local daemons from within mirai map"

man/cloud_config.Rd

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/workbench_config.Rd

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/tests.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test_true(grepl("5555", local_url(tcp = TRUE, port = 5555), fixed = TRUE))
4242
test_type("list", ssh_config("ssh://remotehost"))
4343
test_type("list", ssh_config("ssh://remotehost", tunnel = TRUE))
4444
test_type("list", cluster_config())
45-
test_type("list", tryCatch(workbench_config(), error = function(cnd) list()))
45+
test_class("error", tryCatch(cloud_config(), error = identity))
4646
test_true(is_mirai_interrupt(r <- mirai:::mk_interrupt_error()))
4747
test_print(r)
4848
test_true(is_mirai_error(r <- `class<-`("Error in: testing\n", c("miraiError", "errorValue", "try-error"))))

0 commit comments

Comments
 (0)