From 8c8802d246aae624fdb15fec52ff00fc732b4578 Mon Sep 17 00:00:00 2001 From: Janek Thomas Date: Mon, 5 Feb 2018 15:51:53 +0100 Subject: [PATCH 1/2] more flexible listing in Slurm --- R/clusterFunctionsSlurm.R | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/R/clusterFunctionsSlurm.R b/R/clusterFunctionsSlurm.R index 321fea6d..59347acc 100644 --- a/R/clusterFunctionsSlurm.R +++ b/R/clusterFunctionsSlurm.R @@ -92,19 +92,24 @@ makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array. } listJobsQueued = function(reg) { - args = c("-h", "-o %i", "-u $USER", "-t PD", sprintf("--clusters=%s", clusters)) + args = c("-h", "-o %i", "-u $USER", "-t PD", + sprintf("--clusters=%s", coalesce(clusters, reg$default.resources$clusters)), + sprintf("--partition=%s", coalesce(reg$default.resources$partition))) listJobs(reg, args) } listJobsRunning = function(reg) { - args = c("-h", "-o %i", "-u $USER", "-t R,S,CG", sprintf("--clusters=%s", clusters)) + args = c("-h", "-o %i", "-u $USER", "-t R,S,CG", + sprintf("--clusters=%s", coalesce(clusters, reg$default.resources$clusters)), + sprintf("--partition=%s", coalesce(reg$default.resources$partition))) listJobs(reg, args) } killJob = function(reg, batch.id) { assertRegistry(reg, writeable = TRUE) assertString(batch.id) - cfKillJob(reg, "scancel", c(sprintf("--clusters=%s", clusters), batch.id), nodename = nodename) + cfKillJob(reg, "scancel", c(sprintf("--clusters=%s", coalesce(clusters, reg$default.resources$clusters)), + sprintf("--partition=%s", coalesce(reg$default.resources$partition)), batch.id), nodename = nodename) } makeClusterFunctions(name = "Slurm", submitJob = submitJob, killJob = killJob, listJobsRunning = listJobsRunning, From eda37eaee86ef85f234d1d510bff99be89790dfd Mon Sep 17 00:00:00 2001 From: Janek Thomas Date: Mon, 5 Feb 2018 16:05:01 +0100 Subject: [PATCH 2/2] ... --- R/clusterFunctionsSlurm.R | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/R/clusterFunctionsSlurm.R b/R/clusterFunctionsSlurm.R index 59347acc..b836e45a 100644 --- a/R/clusterFunctionsSlurm.R +++ b/R/clusterFunctionsSlurm.R @@ -92,24 +92,30 @@ makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array. } listJobsQueued = function(reg) { + if (is.null(clusters) && !is.null(reg$default.resources$clusters)) + clusters = reg$default.resources$clusters args = c("-h", "-o %i", "-u $USER", "-t PD", - sprintf("--clusters=%s", coalesce(clusters, reg$default.resources$clusters)), - sprintf("--partition=%s", coalesce(reg$default.resources$partition))) + sprintf("--clusters=%s", clusters), + sprintf("--partition=%s", reg$default.resources$partition)) listJobs(reg, args) } listJobsRunning = function(reg) { + if (is.null(clusters) && !is.null(reg$default.resources$clusters)) + clusters = reg$default.resources$clusters args = c("-h", "-o %i", "-u $USER", "-t R,S,CG", - sprintf("--clusters=%s", coalesce(clusters, reg$default.resources$clusters)), - sprintf("--partition=%s", coalesce(reg$default.resources$partition))) + sprintf("--clusters=%s", clusters), + sprintf("--partition=%s", reg$default.resources$partition)) listJobs(reg, args) } killJob = function(reg, batch.id) { assertRegistry(reg, writeable = TRUE) assertString(batch.id) - cfKillJob(reg, "scancel", c(sprintf("--clusters=%s", coalesce(clusters, reg$default.resources$clusters)), - sprintf("--partition=%s", coalesce(reg$default.resources$partition)), batch.id), nodename = nodename) + if (is.null(clusters) && !is.null(reg$default.resources$clusters)) + clusters = reg$default.resources$clusters + cfKillJob(reg, "scancel", c(sprintf("--clusters=%s", clusters), + sprintf("--partition=%s", reg$default.resources$partition), batch.id), nodename = nodename) } makeClusterFunctions(name = "Slurm", submitJob = submitJob, killJob = killJob, listJobsRunning = listJobsRunning,