@@ -108,8 +108,10 @@ launch_remote <- function(
108108 if (is.null(tls )) tls <- envir [[" tls" ]]
109109
110110 if (length(remote ) == 2L ) {
111- submit_job <- .subset2(rstudio(), " .rs.api.launcher.submitJob" )
112- new_container <- .subset2(rstudio(), " .rs.api.launcher.newContainer" )
111+ tools <- posit_tools()
112+ is.environment(tools ) || stop(._ [[" posit_api" ]])
113+ submit_job <- .subset2(tools , " .rs.api.launcher.submitJob" )
114+ new_container <- .subset2(tools , " .rs.api.launcher.newContainer" )
113115 cluster <- remote [[" name" ]]
114116 container <- new_container(remote [[" image" ]])
115117 lapply(
@@ -475,12 +477,15 @@ cluster_config <- function(
475477cloud_config <- function (platform = " posit" ) {
476478 switch (
477479 tolower(platform ),
478- posit = TRUE ,
480+ posit = {
481+ tools <- posit_tools()
482+ is.environment(tools ) || stop(._ [[" posit_api" ]])
483+ get_info <- .subset2(tools , " .rs.api.launcher.getInfo" )
484+ cluster <- get_info()[[" clusters" ]][[1L ]]
485+ list (name = cluster [[" name" ]], image = cluster [[" defaultImage" ]])
486+ },
479487 stop(._ [[" platform_unsupported" ]])
480488 )
481- get_info <- .subset2(rstudio(), " .rs.api.launcher.getInfo" )
482- cluster <- get_info()[[" clusters" ]][[1L ]]
483- list (name = cluster [[" name" ]], image = cluster [[" defaultImage" ]])
484489}
485490
486491# ' URL Constructors
@@ -567,11 +572,11 @@ find_dot <- function(args) {
567572 sel
568573}
569574
570- rstudio <- function () {
571- idx <- match(" tools:rstudio" , search())
572- is.na( idx ) && stop( ._ [[ " rstudio_api " ]] )
575+ posit_tools <- function () {
576+ idx <- match(" tools:rstudio" , search(), nomatch = 0L )
577+ idx || return ( )
573578 tools <- as.environment(idx )
574579 feature_available <- .subset2(tools , " .rs.api.launcher.jobsFeatureAvailable" )
575- is.function(feature_available ) && feature_available() || stop( ._ [[ " rstudio_api " ]] )
580+ is.function(feature_available ) && feature_available() || return ( )
576581 tools
577582}
0 commit comments