I'm launching a job via
rstudioapi::jobRunScript(
path = 'my_script.R'
, name = 'job1'
, workingDir = getwd()
)
where my_script.R
simply contains a single call to a function that in turn is defined with the following at its outset:
dump_and_quit = function() {
# Save debugging info to file last.dump.rda
dump.frames(to.file = TRUE)
# Quit R with error status
q(status = 1)
}
options(error = dump_and_quit)
(from this answer)
The function later does a bunch of things and has output that I indeed start to see in the jobs output pane, but at random-seeming times the job state is suddenly "failed" and I have no output anywhere indicating what went wrong, nor is there the expected last.dump file in the working dir. Any suggestions?