rstudio / rstudioapi

Safely access RStudio's API (when available)
http://rstudio.github.io/rstudioapi
Other
167 stars 36 forks source link

isJob() returns false for Workbench Jobs #287

Open jthomasmock opened 1 year ago

jthomasmock commented 1 year ago

In Workbench, as far as I can tell with my testing, isJob() returns TRUE only when used as Background Job and return FALSE when executed in a Workbench Job.

Could we modify the check so that it also returns TRUE when called from within a Workbench Job?

One example was a customer asking for how to have different behavior when run in dev (local interactive session) and use different data for example when run in a Workbench Job in a much lager scaled session.

jgutman commented 11 months ago

Note that the rstudioapi functions beginning with launcher (e.g. launcherGetJobs launcherGetJob launcherControlJob) actually refer to Workbench jobs -- we updated this in the rstudioapi documentation for these functions, but we didn't add aliases to call them workbench jobs. Most of those functions depend on knowing the workbench job ID, but there's probably a way to check this from within the workbench job without knowing the actual job ID (and in any case rstudioapi::launcher_* functions are mostly inaccessible from within a workbench job, since those jobs are not actually running in an RStudio session)