How can you enter the environment of a failed job?

I have just finished running a 3 hour job that failed after the critical code had been completed. So, if I had been in the environment of the running job, I would have been able to use the result. I am wondering how I can enter the environment of the job so that I can save the results somewhere. It's not obvious how to do this but it seems like it should be possible.

https://adv-r.hadley.nz/debugging.html#non-interactive-debugging

22.5.1 dump.frames()

dump.frames() is the equivalent to recover() for non-interactive code; it saves a last.dump.rda file in the working directory. Later, an interactive session, you can load("last.dump.rda"); debugger() to enter an interactive debugger with the same interface as recover() . This lets you “cheat”, interactively debugging code that was run non-interactively.

# In batch R process ----
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)

# In a later interactive session ----
load("last.dump.rda")
debugger()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.