Starts a single job on the local machine.

testJob(id, external = FALSE, reg = getDefaultRegistry())



[integer(1) or data.table]
Single integer to specify the job or a data.table with column and exactly one row.


Run the job in an external R session? If TRUE, starts a fresh R session on the local machine to execute the with execJob. You will not be able to use debug tools like traceback or browser.

If external is set to FALSE (default) on the other hand, testJob will execute the job in the current R session and the usual debugging tools work. However, spotting missing variable declarations (as they are possibly resolved in the global environment) is impossible. Same holds for missing package dependency declarations.


Registry. If not explicitly passed, uses the default registry (see setDefaultRegistry).


Returns the result of the job if successful.

See also


tmp = makeRegistry(file.dir = NA, make.default = FALSE)
#> Sourcing configuration file '~/.batchtools.conf.R' ...
#> Created registry in '/tmp/batchtools-example/reg' using cluster functions 'Interactive'
batchMap(function(x) if (x == 2) xxx else x, 1:2, reg = tmp)
#> Adding 2 jobs ...
testJob(1, reg = tmp)
#> ### [bt]: Setting seed to 1 ...
#> [1] 1
# NOT RUN { testJob(2, reg = tmp) # }