batchMapResults {BatchJobs} | R Documentation |
Maps a function over the results of a registry by using batchMap.
Description
Maps a function over the results of a registry by using batchMap.
Usage
batchMapResults(
reg,
reg2,
fun,
...,
ids,
part = NA_character_,
more.args = list()
)
Arguments
reg |
[ |
reg2 |
[ |
fun |
[ |
... |
[any] |
ids |
[ |
part |
[ |
more.args |
[ |
Value
Vector of type integer
with job ids.
Examples
reg1 = makeRegistry(id = "BatchJobsExample1", file.dir = tempfile(), seed = 123)
# square some numbers
f = function(x) x^2
batchMap(reg1, f, 1:10)
# submit jobs and wait for the jobs to finish
submitJobs(reg1)
waitForJobs(reg1)
# look at results
reduceResults(reg1, fun = function(aggr,job,res) c(aggr, res))
reg2 = makeRegistry(id = "BatchJobsExample2", file.dir = tempfile(), seed = 123)
# define function to tranform results, we simply do the inverse of the squaring
g = function(job, res) sqrt(res)
batchMapResults(reg1, reg2, fun = g)
# submit jobs and wait for the jobs to finish
submitJobs(reg2)
waitForJobs(reg2)
# check results
reduceResults(reg2, fun = function(aggr,job,res) c(aggr, res))