1
0
Fork 0
mirror of https://github.com/MillironX/nf-configs.git synced 2024-11-25 17:29:55 +00:00

Move cluster options creating closure out of process scope

This commit is contained in:
Pontus Freyhult 2021-04-08 09:45:29 +02:00
parent 4d64db85eb
commit fa1b4cb412

View file

@ -11,25 +11,26 @@ singularity {
def hostname = "sinfo --local -N -h | head -1 | cut -f1 -d' ' ".execute().text.trim() def hostname = "sinfo --local -N -h | head -1 | cut -f1 -d' ' ".execute().text.trim()
// closure to create a suitable clusterOptions
def clusterOptionsCreator = { m ->
String base = "-A $params.project ${params.clusterOptions ?: ''}"
// Do not use -p node on irma or if a thin node/core is enough
if (m < 125.GB || hostname ==~ "i.*") {
return base
}
if (m < 250.GB) {
return base + " -p node -C mem256GB "
}
// Remaining cases use the largest available node (1 Tbyte for rackham, 512 Gbyte for others)
if (hostname ==~ "r.*") {
return base + " -p node -C mem1TB "
}
return base + " -p node -C mem512GB "
}
process { process {
// closure to create a suitable clusterOptions
def clusterOptionsCreator = { m ->
String base = "-A $params.project ${params.clusterOptions ?: ''}"
// Do not use -p node on irma or if a thin node/core is enough
if (m < 125.GB || hostname ==~ "i.*") {
return base
}
if (m < 250.GB) {
return base + " -p node -C mem256GB "
}
// Remaining cases use the largest available node (1 Tbyte for rackham, 512 Gbyte for others)
if (hostname ==~ "r.*") {
return base + " -p node -C mem1TB "
}
return base + " -p node -C mem512GB "
}
executor = 'slurm' executor = 'slurm'
clusterOptions = { clusterOptionsCreator(task.memory) } clusterOptions = { clusterOptionsCreator(task.memory) }
} }