@@ -95,12 +95,9 @@ launch_remote <- function(n = 1L, remote = remote_config(), ..., .compute = NULL
9595 tls <- envir [[" tls" ]]
9696
9797 if (length(remote ) == 2L ) {
98- platform <- remote [[" platform" ]]
99- args <- remote [[" args" ]]
100- platform != " posit" && stop(._ [[" platform_unsupported" ]])
10198 tools <- posit_tools()
10299 is.environment(tools ) || stop(._ [[" posit_api" ]])
103- return (posit_workbench_launch(n , args , tools ))
100+ return (posit_workbench_launch(n , remote , tools ))
104101 }
105102
106103 command <- remote [[" command" ]]
@@ -401,45 +398,33 @@ cluster_config <- function(command = "sbatch", options = "", rscript = "Rscript"
401398 list (command = " /bin/sh" , args = args , rscript = rscript , quote = NULL )
402399}
403400
404- # ' Cloud Remote Launch Configuration
405- # '
406- # ' Generates a remote configuration for launching daemons via cloud /
407- # ' cloud-based managed platforms.
401+ # ' Posit Workbench Launch Configuration
408402# '
409- # ' @param platform \[default "posit"\] character name of the platform
410- # ' (case-insensitive). Currently the only option is "posit" to use the Posit
411- # ' Workbench launcher.
403+ # ' Generates a remote configuration for launching daemons via the default
404+ # ' launcher in Posit Workbench. Currently only supports Rstudio Pro sessions.
412405# '
413406# ' @inherit remote_config return
414407# '
415408# ' @seealso [ssh_config()], [cluster_config()], and [remote_config()] for other
416409# ' types of remote launch configuration.
417410# '
418411# ' @examples
419- # ' tryCatch(cloud_config (), error = identity)
412+ # ' tryCatch(posit_workbench_config (), error = identity)
420413# '
421414# ' \dontrun{
422415# '
423416# ' # Launch 2 daemons using the Posit Workbench default:
424- # ' daemons(n = 2, url = host_url(), remote = cloud_config(platform = "posit") )
417+ # ' daemons(n = 2, url = host_url(), remote = posit_workbench_config( )
425418# ' }
426419# '
427420# ' @export
428421# '
429- cloud_config <- function (platform = " posit" ) {
430- platform <- tolower(platform )
431- args <- switch (
432- platform ,
433- posit = {
434- tools <- posit_tools()
435- is.environment(tools ) || stop(._ [[" posit_api" ]])
436- get_info <- .subset2(tools , " .rs.api.launcher.getInfo" )
437- cluster <- get_info()[[" clusters" ]][[1L ]]
438- list (name = cluster [[" name" ]], image = cluster [[" defaultImage" ]])
439- },
440- stop(._ [[" platform_unsupported" ]])
441- )
442- list (platform = platform , args = args )
422+ posit_workbench_config <- function () {
423+ tools <- posit_tools()
424+ is.environment(tools ) || stop(._ [[" posit_api" ]])
425+ get_info <- .subset2(tools , " .rs.api.launcher.getInfo" )
426+ cluster <- get_info()[[" clusters" ]][[1L ]]
427+ list (name = cluster [[" name" ]], image = cluster [[" defaultImage" ]])
443428}
444429
445430# ' URL Constructors
@@ -536,15 +521,15 @@ posit_tools <- function() {
536521 tools
537522}
538523
539- posit_workbench_launch <- function (n , args , tools ) {
524+ posit_workbench_launch <- function (n , remote , tools ) {
540525 submit_job <- .subset2(tools , " .rs.api.launcher.submitJob" )
541526 new_container <- .subset2(tools , " .rs.api.launcher.newContainer" )
542- cluster <- args [[" name" ]]
543- container <- new_container(args [[" image" ]])
527+ cluster <- remote [[" name" ]]
528+ container <- new_container(remote [[" image" ]])
544529 cmds <- launch_remote(n )
545530 lapply(cmds , function (cmd )
546531 submit_job(
547- sprintf(" mirai_daemon_%s" , random(3L )),
532+ sprintf(" mirai_daemon_%s" , random(4L )),
548533 cluster = cluster ,
549534 command = cmd ,
550535 container = container
0 commit comments