sourceHotCode.Job: Sources and removes code in the hot/ and src/hot/ directories

Description Usage Arguments Details Value Author(s) See Also

Description

Sources and removes code in the hot/ and src/hot/ directories, that is, directories named hot/ in both the current job directory as well as the common src/ directory, making it possible either patch specific jobs or all jobs. If not put in a directory named 'global', the code will be sourced into the calling environment, which typically is "inside" the onRun() function.

WARNING: By default, hot plugin files that were sourced, are removed afterward!

By calling this method repetably in onRun(job), say, in the main iteration loop, it is possible to update code while a job is running. One situation where this has been found to be useful is when it takes literally days to process a job and when almost done you have been told that there will be a power-shut before you job finishes. By plugging in new code this way, you can save you current session and shut it down nicely to be continued later. Note, there is currently now methods provided by R.batch that does this for you; you have to implement reloading etc. yourself.

Errors that occurs while sourcing the hot code, for instance syntax errors but also evaluation errors, are skipped with a warning and recorded in the log file. This way you will not killa process by misstake that have been running for days.

Note that code in hot/ and src/hot/ will also be source by *setup() on startup.

Usage

1
2
## S3 method for class 'Job'
sourceHotCode(this, remove=TRUE, envir=getEnvironment(this), ...)

Arguments

remove

If TRUE, hot patch files will be removed after being read, otherwise not.

envir

The environment where the source code should be stored.

...

Not used.

Details

All scripts files are evaluated with source() to the local working environment of this job. That is, no global objects will be overwritten.

Value

Returns (invisibly) a vector of the files sourced.

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

See Also

*run(). For more information see Job.


R.batch documentation built on May 2, 2019, 4:58 p.m.