Skip to content

Slurm testing on Travis, update SLURM templates #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.Rhistory
*~
.DS_Store
/inst/doc
/src/*.so
Expand Down
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dist: trusty
sudo: false
sudo: true
language: r
cache: packages

Expand All @@ -13,6 +12,7 @@ addons:
packages:
- libopenmpi-dev
- openmpi-bin
- slurm-llnl

r:
- oldrel
Expand All @@ -23,5 +23,16 @@ r_packages:
- covr
- Rmpi

script:
- sudo cp inst/conf/slurm.conf /etc/slurm-llnl
- sudo service munge start
- sudo /etc/init.d/slurmctld restart
- sudo /etc/init.d/slurmd restart
- sinfo
- R CMD build .
- R CMD check *tar.gz

after_success:
- if [[ "${TRAVIS_R_VERSION_STRING}" == "release" ]]; then Rscript -e 'covr::coveralls()'; fi


5 changes: 5 additions & 0 deletions inst/conf/slurm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## this is used in tests/testthat/test_slurm.R
cluster.functions = makeClusterFunctionsSlurm(system.file(
file.path("templates", "slurm-simple.tmpl"),
package="batchtools",
mustWork=TRUE))
55 changes: 55 additions & 0 deletions inst/conf/slurm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# this file is used in tests/testthat/test_slurm.R

# slurm.conf file generated by configurator easy.html.
# Put this file on all nodes of your cluster.
# See the slurm.conf man page for more information.
#
ControlMachine=localhost
#ControlAddr=
#
#MailProg=/bin/mail
MpiDefault=none
#MpiParams=ports=#-#
ProctrackType=proctrack/pgid
ReturnToService=1
SlurmctldPidFile=/var/run/slurm-llnl/slurmctld.pid
#SlurmctldPort=6817
SlurmdPidFile=/var/run/slurm-llnl/slurmd.pid
#SlurmdPort=6818
SlurmdSpoolDir=/var/lib/slurm-llnl/slurmd
SlurmUser=slurm
#SlurmdUser=root
StateSaveLocation=/var/lib/slurm-llnl/slurmctld
SwitchType=switch/none
TaskPlugin=task/none
#
#
# TIMERS
#KillWait=30
#MinJobAge=300
#SlurmctldTimeout=120
#SlurmdTimeout=300
#
#
# SCHEDULING
FastSchedule=1
SchedulerType=sched/backfill
SchedulerParameters=kill_invalid_depend
#SchedulerPort=7321
SelectType=select/linear
#
#
# LOGGING AND ACCOUNTING
AccountingStorageType=accounting_storage/none
ClusterName=cluster
#JobAcctGatherFrequency=30
JobAcctGatherType=jobacct_gather/none
#SlurmctldDebug=3
SlurmctldLogFile=/var/log/slurm-llnl/slurmctld.log
#SlurmdDebug=3
SlurmdLogFile=/var/log/slurm-llnl/slurmd.log
#
#
# COMPUTE NODES
NodeName=localhost CPUs=1 State=UNKNOWN
PartitionName=debug Nodes=localhost Default=YES MaxTime=INFINITE State=UP
2 changes: 1 addition & 1 deletion inst/templates/slurm-dortmund.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (backend == "mpi") {
}

# relative paths are not handled well by Slurm
log.file = fs::path_expand(log.file)
log.file = shQuote(fs::path_expand(log.file))
-%>

#SBATCH --job-name=<%= job.name %>
Expand Down
3 changes: 3 additions & 0 deletions inst/templates/slurm-lido3.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

<%

# relative paths are not handled well by Slurm
log.file = shQuote(fs::path_expand(log.file))

# queue
walltime = asInt(resources$walltime, lower = 60L, upper = 31L * 24L * 60L * 60L)
memory = asInt(resources$memory, lower = 100L, upper = 1024L * 1024L)
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/slurm-simple.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<%
# relative paths are not handled well by Slurm
log.file = fs::path_expand(log.file)
log.file = shQuote(fs::path_expand(log.file))
-%>


Expand Down
32 changes: 32 additions & 0 deletions tests/testthat/test_slurm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
if(interactive())library(testthat)
if(interactive())library(batchtools)
context("slurm")

conf.file <- system.file(
"conf", "slurm.R", package="batchtools", mustWork=TRUE)
res.list <- list(
walltime = 3600, #in seconds.
ncpus=1,
ntasks=1)
sinResult <- function(reg.name){
reg.path <- file.path(tempdir(), reg.name)
unlink(reg.path, recursive=TRUE)
reg <- makeRegistry(reg.path, conf.file=conf.file)
batchMap(sin, c(0, pi/2), reg=reg)
submitJobs(resources=res.list, reg=reg)
waitForJobs(reg=reg)
st <- getJobStatus(reg=reg)
sapply(st$job.id, loadResult)
}
expected <- c(0, 1)

test_that("registry with NO spaces/parens works on slurm", {
computed <- sinResult("reg")
expect_equal(computed, expected)
})

test_that("registry WITH spaces/parens works on slurm", {
computed <- sinResult("reg (!)")
expect_equal(computed, expected)
})