diff --git a/docs/articles/batchtools.html b/docs/articles/batchtools.html index 6f5992ac..14e0f43a 100644 --- a/docs/articles/batchtools.html +++ b/docs/articles/batchtools.html @@ -295,7 +295,7 @@

4 * mean(d <= 1) } piApprox(1000) -
## [1] 3.092
+
## [1] 3.1

We now parallelize piApprox() with batchtools: We create 10 jobs, each doing a MC simulation with \(10^5\) jobs. We use batchMap() to define the jobs (note that this does not yet start the calculation):

batchMap(fun = piApprox, n = rep(1e5, 10))
## Adding 10 jobs ...
@@ -329,7 +329,7 @@

If you are absolutely sure that your function works, you can take a shortcut and use batchtools in an lapply fashion using btlapply(). This function creates a temporary registry (but you may also pass one yourself), calls batchMap(), wait for the jobs to terminate with waitForJobs() and then uses reduceResultsList() to return the results.

res = btlapply(rep(1e5, 10), piApprox)
 mean(unlist(res))
-
## [1] 3.143692
+
## [1] 3.14168

@@ -546,12 +546,12 @@

## 2: 9 TRUE TRUE Error in (function (value) : Ooops.

If we want to peek into the R log file of a job to see more context for the error we can use showLog() which opens a pager or use getLog() to get the log as character vector:

tail(getLog(id = 9))
-
## [1] "### [bt 2017-08-07 19:31:56]: Memory measurement disabled"                           
-## [2] "### [bt 2017-08-07 19:31:56]: Starting job [batchtools job.id=9]"                    
+
## [1] "### [bt 2017-08-07 19:53:34]: Memory measurement disabled"                           
+## [2] "### [bt 2017-08-07 19:53:34]: Starting job [batchtools job.id=9]"                    
 ## [3] "Error in (function (value)  : Ooops."                                                
 ## [4] ""                                                                                    
-## [5] "### [bt 2017-08-07 19:31:56]: Job terminated with an exception [batchtools job.id=9]"
-## [6] "### [bt 2017-08-07 19:31:56]: Calculation finished!"
+## [5] "### [bt 2017-08-07 19:53:34]: Job terminated with an exception [batchtools job.id=9]" +## [6] "### [bt 2017-08-07 19:53:34]: Calculation finished!"

You can also grep for messages (output suppressed in this vignette for technical reasons):

grepLogs(pattern = "simple", ignore.case = TRUE)

diff --git a/docs/news/index.html b/docs/news/index.html index fc277aee..8d9e2de1 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -102,14 +102,14 @@

  • addExperiments() now warns if a design is passed as data.frame with factor columns and stringsAsFactors is TRUE.
  • Added functions setJobNames() and getJobNames() to control the name of jobs on batch systems. Templates should be adapted to use job.name instead of job.hash for naming.
  • -
  • Argument flatten of getJobResources(), getJobPars and getJobTable is deprecated and will be removed. Future versions of the functions will behave like flatten is set to FALSE explicitly. Single resources/parameters must be extracted manually (or using unnest in package tidyr).
  • +
  • Argument flatten of getJobResources(), getJobPars() and getJobTable() is deprecated and will be removed. Future versions of the functions will behave like flatten is set to FALSE explicitly. Single resources/parameters must be extracted manually (or with tidyr::unnest()).
  • batchtools 0.9.3

    diff --git a/docs/reference/JobCollection.html b/docs/reference/JobCollection.html index 76276452..eb9240d5 100644 --- a/docs/reference/JobCollection.html +++ b/docs/reference/JobCollection.html @@ -148,7 +148,7 @@

    See a

    Examples

    -
    tmp = makeRegistry(file.dir = NA, make.default = FALSE, packages = "methods")
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry361641090f2e' using cluster functions 'Interactive'
    batchMap(identity, 1:5, reg = tmp)
    #> Adding 5 jobs ...
    +
    tmp = makeRegistry(file.dir = NA, make.default = FALSE, packages = "methods")
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc1296e5171' using cluster functions 'Interactive'
    batchMap(identity, 1:5, reg = tmp)
    #> Adding 5 jobs ...
    # resources are usually set in submitJobs() jc = makeJobCollection(1:3, resources = list(foo = "bar"), reg = tmp) ls(jc)
    #> [1] "array.jobs" "array.var" "file.dir" "job.hash" "job.name" diff --git a/docs/reference/JobExperiment.html b/docs/reference/JobExperiment.html index 372027aa..8ffab71d 100644 --- a/docs/reference/JobExperiment.html +++ b/docs/reference/JobExperiment.html @@ -148,12 +148,12 @@

    Value

    Examples

    -
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry3616660968e4' using cluster functions 'Interactive'
    batchMap(function(x, y) x + y, x = 1:2, more.args = list(y = 99), reg = tmp)
    #> Adding 2 jobs ...
    submitJobs(resources = list(foo = "bar"), reg = tmp)
    #> Submitting 2 jobs in 2 chunks using cluster functions 'Interactive' ...
    job = makeJob(1, reg = tmp) +
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc1318ece8' using cluster functions 'Interactive'
    batchMap(function(x, y) x + y, x = 1:2, more.args = list(y = 99), reg = tmp)
    #> Adding 2 jobs ...
    submitJobs(resources = list(foo = "bar"), reg = tmp)
    #> Submitting 2 jobs in 2 chunks using cluster functions 'Interactive' ...
    job = makeJob(1, reg = tmp) print(job)
    #> <Job> #> Inherits from: <BaseJob> #> Public: #> external.dir: active binding -#> file.dir: /tmp/RtmpZmp9mQ/registry3616660968e4 +#> file.dir: /tmp/RtmpFgx6O2/registry4fc1318ece8 #> fun: active binding #> id: 1 #> initialize: function (file.dir, reader, id, pars, seed, resources) diff --git a/docs/reference/JobNames.html b/docs/reference/JobNames.html index 39f82d2e..89add4db 100644 --- a/docs/reference/JobNames.html +++ b/docs/reference/JobNames.html @@ -131,7 +131,7 @@

    Value

    Examples

    -
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry36165bafd2cd' using cluster functions 'Interactive'
    ids = batchMap(identity, 1:10, reg = tmp)
    #> Adding 10 jobs ...
    setJobNames(ids, letters[1:nrow(ids)], reg = tmp) +
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc130e23d8' using cluster functions 'Interactive'
    ids = batchMap(identity, 1:10, reg = tmp)
    #> Adding 10 jobs ...
    setJobNames(ids, letters[1:nrow(ids)], reg = tmp) getJobNames(reg = tmp)
    #> job.id job.name #> <int> <char> #> 1: 1 a diff --git a/docs/reference/JoinTables.html b/docs/reference/JoinTables.html index cb84c888..b6e65c8a 100644 --- a/docs/reference/JoinTables.html +++ b/docs/reference/JoinTables.html @@ -149,7 +149,7 @@

    Value

    Examples

    # Create two tables for demonstration -tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry3616667959e8' using cluster functions 'Interactive'
    batchMap(identity, x = 1:6, reg = tmp)
    #> Adding 6 jobs ...
    x = getJobPars(reg = tmp) +tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc17a64abf2' using cluster functions 'Interactive'
    batchMap(identity, x = 1:6, reg = tmp)
    #> Adding 6 jobs ...
    x = getJobPars(reg = tmp) y = findJobs(x >= 2 & x <= 5, reg = tmp) y$extra.col = head(letters, nrow(y)) diff --git a/docs/reference/Tags.html b/docs/reference/Tags.html index 877f6336..bc9efc13 100644 --- a/docs/reference/Tags.html +++ b/docs/reference/Tags.html @@ -129,7 +129,7 @@

    Value

    Examples

    -
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry36165e04110e' using cluster functions 'Interactive'
    ids = batchMap(sqrt, x = -3:3, reg = tmp)
    #> Adding 7 jobs ...
    +
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc15c8eb4a3' using cluster functions 'Interactive'
    ids = batchMap(sqrt, x = -3:3, reg = tmp)
    #> Adding 7 jobs ...
    # Add new tag to all ids addJobTags(ids, "needs.computation", reg = tmp) getJobTags(reg = tmp)
    #> job.id tags diff --git a/docs/reference/addAlgorithm.html b/docs/reference/addAlgorithm.html index de71dfc4..e4e727f9 100644 --- a/docs/reference/addAlgorithm.html +++ b/docs/reference/addAlgorithm.html @@ -133,7 +133,7 @@

    Value

    Examples

    -
    tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry36161746d75b' using cluster functions 'Interactive'
    addProblem("p1", fun = function(job, data) data, reg = tmp)
    #> Adding problem 'p1'
    addProblem("p2", fun = function(job, data) job, reg = tmp)
    #> Adding problem 'p2'
    getProblemIds(reg = tmp)
    #> [1] "p1" "p2"
    +
    tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc1165762e5' using cluster functions 'Interactive'
    addProblem("p1", fun = function(job, data) data, reg = tmp)
    #> Adding problem 'p1'
    addProblem("p2", fun = function(job, data) job, reg = tmp)
    #> Adding problem 'p2'
    getProblemIds(reg = tmp)
    #> [1] "p1" "p2"
    addAlgorithm("a1", fun = function(job, data, instance) instance, reg = tmp)
    #> Adding algorithm 'a1'
    getAlgorithmIds(reg = tmp)
    #> [1] "a1"
    removeAlgorithms("a1", reg = tmp)
    #> Removing Algorithm 'a1' and 0 corresponding jobs ...
    #> Removing 0 obsolete result files ...
    #> Removing 0 obsolete log files ...
    #> Removing 0 obsolete job collection files ...
    #> Removing 0 job description files ...
    #> Removing 0 external directories of unsubmitted jobs ...
    #> Removing 0 resource specifications ...
    #> Removing 0 tags ...
    getAlgorithmIds(reg = tmp)
    #> character(0)
    diff --git a/docs/reference/addExperiments.html b/docs/reference/addExperiments.html index 20ccd785..0351572d 100644 --- a/docs/reference/addExperiments.html +++ b/docs/reference/addExperiments.html @@ -156,7 +156,7 @@

    See a

    Examples

    -
    tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry361678c7a60d' using cluster functions 'Interactive'
    +
    tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc17d2e261d' using cluster functions 'Interactive'
    # add first problem fun = function(job, data, n, mean, sd, ...) rnorm(n, mean = mean, sd = sd) addProblem("rnorm", fun = fun, reg = tmp)
    #> Adding problem 'rnorm'
    diff --git a/docs/reference/addProblem.html b/docs/reference/addProblem.html index fb17c2d8..6cb67f58 100644 --- a/docs/reference/addProblem.html +++ b/docs/reference/addProblem.html @@ -158,7 +158,7 @@

    Value

    Examples

    -
    tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry3616160f8d11' using cluster functions 'Interactive'
    addProblem("p1", fun = function(job, data) data, reg = tmp)
    #> Adding problem 'p1'
    addProblem("p2", fun = function(job, data) job, reg = tmp)
    #> Adding problem 'p2'
    getProblemIds(reg = tmp)
    #> [1] "p1" "p2"
    +
    tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc17d81016e' using cluster functions 'Interactive'
    addProblem("p1", fun = function(job, data) data, reg = tmp)
    #> Adding problem 'p1'
    addProblem("p2", fun = function(job, data) job, reg = tmp)
    #> Adding problem 'p2'
    getProblemIds(reg = tmp)
    #> [1] "p1" "p2"
    addAlgorithm("a1", fun = function(job, data, instance) instance, reg = tmp)
    #> Adding algorithm 'a1'
    getAlgorithmIds(reg = tmp)
    #> [1] "a1"
    removeAlgorithms("a1", reg = tmp)
    #> Removing Algorithm 'a1' and 0 corresponding jobs ...
    #> Removing 0 obsolete result files ...
    #> Removing 0 obsolete log files ...
    #> Removing 0 obsolete job collection files ...
    #> Removing 0 job description files ...
    #> Removing 0 external directories of unsubmitted jobs ...
    #> Removing 0 resource specifications ...
    #> Removing 0 tags ...
    getAlgorithmIds(reg = tmp)
    #> character(0)
    diff --git a/docs/reference/batchExport.html b/docs/reference/batchExport.html index 1577f534..140f3657 100644 --- a/docs/reference/batchExport.html +++ b/docs/reference/batchExport.html @@ -125,21 +125,21 @@

    Value

    Examples

    -
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpZmp9mQ/registry3616555ae6ca' using cluster functions 'Interactive'
    +
    tmp = makeRegistry(file.dir = NA, make.default = FALSE)
    #> Sourcing configuration file '/home/michel/.config/batchtools/config.R' ...
    #> Created registry in '/tmp/RtmpFgx6O2/registry4fc16c961092' using cluster functions 'Interactive'
    # list exports exports = batchExport(reg = tmp) print(exports)
    #> Empty data.table (0 rows) of 2 cols: name,uri
    #> NULL
    # add a job and required exports batchMap(function(x) x^2 + y + z, x = 1:3, reg = tmp)
    #> Adding 3 jobs ...
    exports = batchExport(export = list(y = 99, z = 1), reg = tmp)
    #> Exporting new objects: 'y','z' ...
    print(exports)
    #> name uri #> <char> <char> -#> 1: y /tmp/RtmpZmp9mQ/registry3616555ae6ca/exports/PE.rds -#> 2: z /tmp/RtmpZmp9mQ/registry3616555ae6ca/exports/PI.rds
    +#> 1: y /tmp/RtmpFgx6O2/registry4fc16c961092/exports/PE.rds +#> 2: z /tmp/RtmpFgx6O2/registry4fc16c961092/exports/PI.rds
    submitJobs(reg = tmp)
    #> Submitting 3 jobs in 3 chunks using cluster functions 'Interactive' ...
    waitForJobs(reg = tmp)
    #> Syncing 3 files ...
    #> [1] TRUE
    stopifnot(loadResult(1, reg = tmp) == 101) # Un-export z exports = batchExport(unexport = "z", reg = tmp)
    #> Un-exporting exported objects: 'z' ...
    print(exports)
    #> name uri #> <char> <char> -#> 1: y /tmp/RtmpZmp9mQ/registry3616555ae6ca/exports/PE.rds
    +#> 1: y /tmp/RtmpFgx6O2/registry4fc16c961092/exports/PE.rds