Workbench Jobs

Advanced

Workbench Jobs allows you to run R scripts in new sessions independent of your current RStudio Pro session. These jobs are helpful for executing long-running scripts such as training models or running multiple jobs simultaneously. Users can also run Background Jobs on RStudio Pro. However, Background Jobs runs in the same RStudio Pro session, whereas Workbench Jobs runs independently of RStudio Pro sessions. See a comparison of Background Jobs vs. Workbench Jobs below.

Note

The ability to run Workbench Jobs requires your server administrator to configure Job Launcher. Contact your server administrator to change these defaults and refer them to the Job Launcher section of the Administration Guide.

To start a Workbench Job, in an RStudio Pro session, select Source as Workbench Job…:

Source script as Workbench Job

Depending on how your administrator has set up Posit Workbench, different options will be available when launching a job. Resource sizing and Docker image selection options will be available if Posit Workbench utilizes an external cluster such as Slurm or Kubernetes.

Workbench job option dialog

Monitoring Workbench Jobs

Once a Workbench Job is created, jobs can be monitored from the Workbench Jobs tab of any RStudio Pro session, which shows all of your jobs (not just those launched from the current session). You can safely quit your R session without affecting any currently running Workbench Jobs.

IDE tab showing status of Workbench jobs

You can also monitor the status of running and completed Workbench Jobs on the Posit Workbench home page:

Posit Workbench home page section showing executing Workbench Jobs

Workbench Jobs vs Background Jobs

Local Background Jobs are supported by all versions of the RStudio IDE, server, and desktop. Workbench Jobs are a feature of RStudio Pro and VS Code sessions on Posit Workbench, which execute remotely from the current session, and can use the resources of a remote resource manager like Kubernetes or Slurm. The table below provides a comparison.

Background Job Workbench Job
Availability Open source RStudio Desktop, RStudio Server, RStudio Desktop Pro, and Posit Workbench’s RStudio Pro. Posit Workbench’s RStudio Pro and VS Code.
Where process runs As a child process in the same session as the current session. As a new process either on the local server or off-host.
Visibility Only see the job status in the Background Job pane from the session that initiated the job. View the job status from the Workbench Workspaces page or from the Workbench Jobs pane from any RStudio Pro session or the Workbench extension in any VS Code session.
Lifetime

If you close the working session, the job terminates.

In the RStudio Desktop, you will be warned if you attempt to close the window while the background job is still running.

In open source RStudio Server or Workbench, the session will not be suspended if a background job is running.

Because it is a separate process from the session that launched it, you can close the working session and still have your Workbench Job run. |
Environment

You can elect to run the Background Job with a copy of the current session’s global environment and/or copy the results back to the session’s global environment.

Because the job is running as a child process of the current session, any environment variables set process-level or shell-level are passed to the background job from the main session.

The job runs in a clean environment.
Back to top