Skip to content

Commit

Permalink
Enable parameter_step to set limt concurrently running jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
tikk3r committed Oct 25, 2019
1 parent 79321f4 commit 2326732
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions GRID_LRT/application/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def __init__(self, numjobs=1, token_type='t_test',
else:
self.__check_authorized()
if numjobs < 1:
logging.warn("jdl_file with zero jobs!")
logging.warn("Slurm file with zero jobs!")
numjobs = 1
self.numjobs = numjobs
self.parameter_step = parameter_step
Expand Down Expand Up @@ -379,9 +379,9 @@ def build_slurm_file(self, database=None):
raise IOError("Launch file doesn't exist! "+self.launch_file)
slurmfile = '#!/usr/bin/env bash'
if self.wholenodes:
slurmfile += '#SBATCH --exclusive --nodes=1 --cpus-per-task={ncpu:d} -p {queue:s}'
slurmfile += '#SBATCH --exclusive --nodes=1 --cpus-per-task={ncpu:d} -p {queue:s} --array 1-{njobs:d}%{concurrent:d}'
else:
slurmfile += '#SBATCH --nodes=1 --cpus-per-task={ncpu:d} -p {queue:s}'
slurmfile += '#SBATCH --nodes=1 --cpus-per-task={ncpu:d} -p {queue:s} --array 1-{njobs:d}%{concurrent:d}'
slurmfile += """
echo Job landed on $(hostname)
JOBDIR=$(mktemp -d -p $TMPDIR)
Expand All @@ -391,7 +391,9 @@ def build_slurm_file(self, database=None):
cd $JOBDIR
{launcher:s} {db:s} {usr:s} {pw:s} {tt:s}
""".format(ncpu=int(self.ncpu),
queueu=str(self.queue)
queueu=str(self.queue),
njobs=self.numjobs,
concurrent=self.parameter_step,
launcher=str(self.launch_file),
db=str(database),
usr=str(creds.user),
Expand Down

0 comments on commit 2326732

Please sign in to comment.