Skip to content

Using Background Jobs in the RStudio IDE#

RStudio 1.2 introduced the ability to send long running R scripts to local and remote background jobs. This functionality can dramatically improve the productivity of data scientists and analysts using R since they can continue working in RStudio while jobs are running in the background.

Local background jobs are supported by all versions of RStudio, server and desktop. Remote background jobs are a feature of RStudio Server Pro and are orchestrated by the Launcher, which also supports running interactive R sessions on remote resource managers like Kubernetes. More information about setting up and adminstering the Launcher can be found here.

Background jobs can be started manually or programatically. As mentioned in the RStudio blog post, local background jobs are ideal for interactive, ad-hoc usage. The callr package provides a mechanism for programatically orchestrating background R processes.

Shiny App#

Running a Shiny application as a local background job allows the current R session to remain free to work on other things. This can be especially helpful for making changes to the Shiny code and seeing the changes in real time.

Plumber API#

Similar to Shiny applications, plumber APIs can be run as a local background job. This allows the current R session to remain open for things like testing or interacting with the API.

Extract, Transform, Load (ETL)#

Background and Launcher jobs are ideal for long running processes, like loading data from an external database or API.


Long running tasks like simulation studies can be run as background or Launcher jobs in order to keep the original R session open for other work.

Model Training#

Model training, which can often take a long time, is another great use case for background and Launcher jobs. Local jobs are ideal for sequential model training while Launcher jobs can be used to train multiple models in parallel.

Programmatic Jobs#

The rstudioapi package provides tools for programmatically creating local and Launcher jobs.