mlr-org / mlr-org/batchtools

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

Open
#289 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
184
Forks
53
Avg merge
7d 2h
Merged PRs (30d)
1

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in R/execJob.R at the testJob error-handling lines linked in the issue, and inspect how the current options(error = ...) and on.exit() calls are ordered. Make the error handler configurable while preserving the current traceback behavior by default; done means users can supply their own error option without it being overwritten.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.