R: Tests a job by running it with Rscript in a new process.

testJob {BatchJobs} | R Documentation

## Tests a job by running it with Rscript in a new process.

### Description

Useful for debugging. Note that neither the registry, database or file directory are changed.

### Usage

    testJob(reg, id, resources = list(), external = TRUE)

### Arguments

`reg` | [`Registry`] Registry.
`id` | [`integer(1)`] Id of job to test. Default is first job id of registry.
`resources` | [`list`] Usually not needed, unless you call the function `getResources` in your job. See `submitJobs`. Default is empty list.
`external` | [`logical(1)`] Run test in an independent external R session instead of current. The former allows to uncover missing variable definitions (which may accidentially be defined in the current global environment) and the latter is useful to get traceable execeptions. Default is `TRUE`.

### Value

[any]. Result of job. If the job did not complete because of an error, NULL is returned.

### See Also

Other debug: `debugMulticore`; `debugSSH`; `getErrorMessages`; `getJobInfo`; `getLogFiles`; `grepLogs`; `killJobs`; `resetJobs`; `setJobFunction`; `showLog`

### Examples

    reg = makeRegistry(id = "BatchJobsExample", file.dir = tempfile(), seed = 123)
    f = function(x) if (x==1) stop("oops") else x
    batchMap(reg, f, 1:2)
    testJob(reg, 2)

[Package BatchJobs version 1.6 Index]