In Python, one can process SIGTERM using an answer like the one here: How to process SIGTERM signal gracefully?.
How can we do the same thing in R?
In Python, one can process SIGTERM using an answer like the one here: How to process SIGTERM signal gracefully?.
How can we do the same thing in R?
My own investigations have shown that none of the usual mechanisms (on.exit()
, reg.finalizer()
, or the .Last()
handler) are triggered when R receives SIGTERM.
I wrote a very small, silly package to circumvent R's behaviour by installing a signal handler directly: https://github.com/atheriel/sigterm.
But it's probably worth bringing this up with the R developers as well.