@@ -102,22 +102,28 @@ launch_remote <- function(
102102 if (is.null(tls )) tls <- envir [[" tls" ]]
103103
104104 if (length(remote ) == 2L ) {
105- tools <- posit_tools()
106- is.environment(tools ) || stop(._ [[" posit_api" ]])
107- submit_job <- .subset2(tools , " .rs.api.launcher.submitJob" )
108- new_container <- .subset2(tools , " .rs.api.launcher.newContainer" )
109- cluster <- remote [[" name" ]]
110- container <- new_container(remote [[" image" ]])
111- lapply(
112- seq_len(n ),
113- function (x ) submit_job(
114- sprintf(" mirai_daemon_%d" , x ),
115- cluster = cluster ,
116- command = launch_remote(),
117- container = container
105+ platform <- remote [[" platform" ]]
106+ args <- remote [[" args" ]]
107+ platform == " posit" && {
108+ tools <- posit_tools()
109+ is.environment(tools ) || stop(._ [[" posit_api" ]])
110+ submit_job <- .subset2(tools , " .rs.api.launcher.submitJob" )
111+ new_container <- .subset2(tools , " .rs.api.launcher.newContainer" )
112+ cluster <- args [[" name" ]]
113+ container <- new_container(args [[" image" ]])
114+ cmds <- launch_remote(n )
115+ lapply(
116+ cmds ,
117+ function (cmd ) submit_job(
118+ sprintf(" mirai_daemon_%d" , random(4L )),
119+ cluster = cluster ,
120+ command = cmd ,
121+ container = container
122+ )
118123 )
119- )
120- return (invisible ())
124+ return (cmds )
125+ }
126+ stop(._ [[" platform_unsupported" ]])
121127 }
122128
123129 command <- remote [[" command" ]]
@@ -469,8 +475,9 @@ cluster_config <- function(
469475# ' @export
470476# '
471477cloud_config <- function (platform = " posit" ) {
472- switch (
473- tolower(platform ),
478+ platform <- tolower(platform )
479+ args <- switch (
480+ platform ,
474481 posit = {
475482 tools <- posit_tools()
476483 is.environment(tools ) || stop(._ [[" posit_api" ]])
@@ -480,6 +487,7 @@ cloud_config <- function(platform = "posit") {
480487 },
481488 stop(._ [[" platform_unsupported" ]])
482489 )
490+ list (platform = platform , args = args )
483491}
484492
485493# ' URL Constructors
0 commit comments