Skip to content

Commit

Permalink
Merge branch 'master' of github.com:berndbischl/parallelMap
Browse files Browse the repository at this point in the history
  • Loading branch information
berndbischl committed Feb 3, 2015
2 parents a89b9bd + 29e487b commit 25ab147
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/parallelStart.R
Expand Up @@ -88,12 +88,19 @@ parallelStart = function(mode, cpus, socket.hosts, bj.resources = list(), loggin
parallelStop()
}

#FIXME what should we do onexit if an error happens in this function?
#FIXME: what should we do onexit if an error happens in this function?

mode = getPMDefOptMode(mode)
cpus = getPMDefOptCpus(cpus)
socket.hosts = getPMDefOptSocketHosts(socket.hosts)

level = getPMDefOptLevel(level)
rlevls = parallelGetRegisteredLevels()
if (!is.na(level) && level %nin% rlevls) {
warningf("Selected level='%s' not registered! This is likely an error! Note that you can also
register custom levels yourself to get rid of this warning, see ?parallelRegisterLevels.R",
level)
}
logging = getPMDefOptLogging(logging)
storagedir = getPMDefOptStorageDir(storagedir)
# defaults are in batchjobs conf
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test_registerLevels.R
Expand Up @@ -15,3 +15,16 @@ test_that("register levels", {
list(p1 = "p1.lev1", p2 = c("p2.a", "p2.b"), custom = c("custom.x", "custom.y"))
)
})

test_that("warn on unregisterred level", {
# check that we warn
expect_warning(parallelStartBatchJobs(level = "foo"), "not registered")
parallelStop()

# check that we DONT warn for no level
opt = getOption("warn")
options(warn = 2L)
parallelStartBatchJobs()
parallelStop()
options(warn = opt)
})

0 comments on commit 25ab147

Please sign in to comment.