The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
By default, simpleCache
creates caches in the R session you use to call it. If you need to make lots of caches, or very large caches, you may want instead to sub these as jobs to a cluster resource manager (like SLURM). simpleCache can do this using functionality from the batchtools
package.
This vignette is unevaluated because it relies on the batchtools
package and a cluster environment.
To do this, first, create a batchtools
registry. You can follow more detailed documentation in the batchtools
package, but here’s some code to get you started:
library(simpleCache)
setCacheDir(tempdir())
= batchtools::makeRegistry(NA)
registry = system.file("templates/slurm-advanced.tmpl", package = "simpleCache")
templateFile $cluster.functions = batchtools::makeClusterFunctionsSlurm(
registrytemplate = templateFile)
registry
Notice that I’m using a custom slurm template here. With a registry in hand, we next need to define the resources this cache job will require:
= list(ncpus=1, memory=1000, walltime=60, partition="serial") resources
Then, we simply add these as arguments to simpleCache()
like so:
simpleCache("testBatch", {
rnorm(1e7, 0, 1)
batchRegistry=registry, batchResources=resources) },
This will now create and submit a job script to the cluster. That job script will have R code to create your testBatch
cache by calling the code in your simpleCache
call, rnorm(1e7, 0, 1)
. Next time you run this function, it will just load the cache without recreating it, as you would expect simpleCache to do. Now there’s a bunch of other stuff you can use batchtools
to do with these jobs:
::getJobTable(reg=registry)
batchtools::getJobPars()
batchtools::getStatus()
batchtools
::getJobTable(reg=registry)
batchtools::getJobPars(1, reg=registry)
batchtools::loadResult(1, reg=registry)
batchtools# batchtools::testJob(1, reg=registry)
# killJobs()
When you’re done, you may want to remove your temporary registry:
::removeRegistry(reg=registry) batchtools
See batchtools
documentation for more details on using registries.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.