mllg / batchtools

Tools for computation on batch systems
https://mllg.github.io/batchtools/
GNU Lesser General Public License v3.0
169 stars 51 forks source link

Make 'options(error = function(e) traceback(2))` optional in testJob #289

Open mb706 opened 1 year ago

mb706 commented 1 year ago

I would like to run testJob() and drop to the debugger as soon as an error is thrown. However, the following prevents me from just having options(error=recover) do its work:

https://github.com/mllg/batchtools/blob/4c2a476725452e742ed59b9a45457723cd398ab2/R/execJob.R#L50-L51

Maybe you could make this line dependent on some setting, e.g. have an option(error.execjob) or something (default function(e) traceback(2L)) and then do

options(error = getOption("error.execjob", function(e) traceback(2L)))

(btw, it would probably also be cleaner to have the on.exi() happen before the options(error = ...) call).