Say I launch a job using job_id = rstudiapi::jobRunScript(...)
. Then I have the job_id in the main session, but how do I access it from within the child session? Failed attempts include
- parsing through environmental variables. It fails because
Sys.setenv()
is session-specific. - Figuring out how
rstudiapi:::callRemote()
works. Seems you can only launchrstudiapi
functions. -
rstudioapi::documentId()
does not return the job id.
Goal: I'd like to wrap the code in try()
and let the child itself call rstudioapi::jobSetState(job_id, "failed")
if an error is caught. This enables returning work up until the error to minimize loss. In the future, I may also want to callrstudioapi::jobSetProgress()
from within the job.