Skip to content

Commit e889b79

Browse files
committed
workbench_config() -> cloud_config()
1 parent afca2e5 commit e889b79

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)
@@ -60,7 +61,6 @@ export(stop_cluster)
6061
export(stop_mirai)
6162
export(unresolved)
6263
export(with_daemons)
63-
export(workbench_config)
6464
importFrom(nanonext,"opt<-")
6565
importFrom(nanonext,.advance)
6666
importFrom(nanonext,.context)

NEWS.md

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

99
#### New Features
1010

11-
* Adds `workbench_config()` to launch remote daemons using the default-configured Kubernetes or traditional cluster on Posit Workbench.
11+
* Adds `cloud_config()` to launch remote daemons using a cloud / cloud-based managed platform. Currently supports Posit Workbench.
1212
* Adds `with_daemons()` and `local_daemons()` helper functions for using a particular compute profile.
1313
This works with daemons that are already set up unlike the existing `with.miraiDaemons()` method, which creates a new scope and tears it down when finished (#360).
1414
* A mirai now has an attribute `id`, which is a monotonically increasing integer identifier unique to each session.

R/launchers.R

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,28 +409,37 @@ cluster_config <- function(command = "sbatch", options = "", rscript = "Rscript"
409409
list(command = "/bin/sh", args = args, rscript = rscript, quote = NULL)
410410
}
411411

412-
#' Workbench Remote Launch Configuration
412+
#' Cloud Remote Launch Configuration
413413
#'
414-
#' Generates a remote configuration for launching daemons using the default
415-
#' configured Kubernetes or traditional cluster in Posit Workbench.
414+
#' Generates a remote configuration for launching daemons via cloud /
415+
#' cloud-based managed platforms.
416+
#'
417+
#' @param platform \[default "posit"\] character name of the platform
418+
#' (case-insensitive). Currently the only option is "posit" to use the Posit
419+
#' Workbench launcher.
416420
#'
417421
#' @inherit remote_config return
418422
#'
419423
#' @seealso [ssh_config()], [cluster_config()], and [remote_config()] for other
420-
#' remote launch configurations.
424+
#' types of remote launch configuration.
421425
#'
422426
#' @examples
423-
#' tryCatch(workbench_config(), error = identity)
427+
#' tryCatch(cloud_config(), error = identity)
424428
#'
425429
#' \dontrun{
426430
#'
427-
#' # Launch 2 daemons using the Workbench default:
428-
#' daemons(n = 2, url = host_url(), remote = workbench_config())
431+
#' # Launch 2 daemons using the Posit Workbench default:
432+
#' daemons(n = 2, url = host_url(), remote = cloud_config(platform = "posit"))
429433
#' }
430434
#'
431435
#' @export
432436
#'
433-
workbench_config <- function() {
437+
cloud_config <- function(platform = "posit") {
438+
switch(
439+
tolower(platform),
440+
posit = TRUE,
441+
stop(._[["platform_unsupported"]])
442+
)
434443
get_info <- .subset2(rstudio(), ".rs.api.launcher.getInfo")
435444
cluster <- get_info()[["clusters"]][[1L]]
436445
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
@@ -80,7 +80,8 @@
8080
n_zero = "the number of daemons must be zero or greater",
8181
not_found = "compute profile `%s` not found",
8282
numeric_n = "`n` must be numeric, did you mean to provide `url`?",
83-
rstudio_api = "workbench launcher requires a Posit Workbench environment",
83+
platform_unsupported = "`platform` is currently not supported",
84+
rstudio_api = "cannot be used outside of a Posit Workbench environment",
8485
sync_daemons = "mirai: initial sync with daemon(s) [%d secs elapsed]",
8586
sync_dispatcher = "mirai: initial sync with dispatcher [%d secs elapsed]",
8687
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
@@ -43,7 +43,7 @@ test_true(grepl("5555", local_url(tcp = TRUE, port = 5555), fixed = TRUE))
4343
test_type("list", ssh_config("ssh://remotehost"))
4444
test_type("list", ssh_config("ssh://remotehost", tunnel = TRUE))
4545
test_type("list", cluster_config())
46-
test_type("list", tryCatch(workbench_config(), error = function(cnd) list()))
46+
test_class("error", tryCatch(cloud_config(), error = identity))
4747
test_true(is_mirai_interrupt(r <- mirai:::mk_interrupt_error()))
4848
test_print(r)
4949
test_true(is_mirai_error(r <- `class<-`("Error in: testing\n", c("miraiError", "errorValue", "try-error"))))

0 commit comments

Comments
 (0)