Run a function (job) in another session
Arguments
- fun
function to evaluate
- fun_args
list of function arguments
- packages
list of packages to load
- workdir
working directory; default is temporary path
- method
job type; choices are
'rs_job'
and'callr'
- name
name of the job
- job_id
job identification number
- timeout
timeout in seconds before the resolve ends; jobs that are still running are subject to
unresolved
policy- auto_remove
whether to automatically remove the job if resolved; default it true
- unresolved
what to do if the job is still running after timing-out; default is
'warning'
and returnNULL
, other choices are'error'
or'silent'
Value
For start_job
, a string of job identification number;
check_job
returns the job status; resolve_job
returns
the function result.
Examples
if (FALSE) { # \dontrun{
fun <- function() {
Sys.sleep(2)
Sys.getpid()
}
job_id <- start_job(fun)
check_job(job_id)
result <- resolve_job(job_id)
} # }