While background jobs are best suited for one-off, ad-hoc usage, there are times
when it is beneficial to programatically orchestrate background jobs. Local and
Launcher jobs can be programatically handled with functions in the rstudioapi
package . The examples here use the same
estimate-pi.R script as the simulation example.
Local jobs can be started using rstudioapi::jobRunScript(). An example of this
pattern is found in local-jobs.R.
Launcher jobs can be more flexible than local jobs. The
rstudioapi::launcherSubmitJob() function is can be used to launch specific R
commands or scripts as Launcher jobs. An example of this pattern is found in
launcher-jobs.R.
Both the local and Launcher examples illustrated here save output to the
output/ directory. The analyze-output notebook
contains code to analyze and visualize the output files generated by the jobs.
