Skip to content
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
5 changes: 3 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Let's first have a look at the options with the run command.
-d, --dependency INTEGER
-L, --logdir TEXT Directory to write log files
-u, --uniqueid TEXT Unique job pool id
-q, --qos TEXT QOS setting
--help Show this message and exit.

The most important options are ``u``, ``j`` and ``L``. To specify a job you need ``u`` and ``j`` since these parameters uniquely identify a job and allow you to track the progress of your jobs. An example command is below
Expand All @@ -111,13 +112,13 @@ The most important options are ``u``, ``j`` and ``L``. To specify a job you need

This creates a job with a unique id of `001` and a job name of `tas`.

By specifying some of the options listed above, you can adjust the behavior of your slurm jobs. For example, you can put your log files in a specific directory by specifying a value for argument ``L``. Additionally, if you want to use a specific partition on your cluster you can speify the `p` option. Similarly, if your job is particularly compute intensive, with ``n`` you can adjust the number of jobs per node.
By specifying some of the options listed above, you can adjust the behavior of your slurm jobs. For example, you can put your log files in a specific directory by specifying a value for argument ``L``. Additionally, if you want to use a specific partition on your cluster you can specify the `p` option. Similarly, if your job is particularly compute intensive, with ``n`` you can adjust the number of jobs per node.

.. code-block:: bash

$ python tas.py run -u 001 -j tas -L /logs/tas/ -p savio2_bigmem -n 10

Its important to note that, by default, log files will be written to the directory where you are executing the file. Depending on how large your job is you may want to put these log files elsewhere.
It is important to note that, by default, log files will be written to the directory where you are executing the file. Depending on how large your job is you may want to put these log files elsewhere.


If you want to fully take advantage of BRC's computing capacity you can run
Expand Down
18 changes: 15 additions & 3 deletions jrnr/jrnr.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#SBATCH --account=co_laika
#
# QoS:
#SBATCH --qos=savio_lowprio
#SBATCH --qos={qos}
#
#SBATCH --nodes=1
#
Expand Down Expand Up @@ -110,6 +110,7 @@ def _prep_slurm(
filepath,
jobname='slurm_job',
partition='savio2',
qos='savio_lowprio',
job_spec=None,
limit=None,
uniqueid='"${SLURM_ARRAY_JOB_ID}"',
Expand Down Expand Up @@ -161,6 +162,7 @@ def _prep_slurm(
f.write(template.format(
jobname=jobname,
partition=partition,
qos=qos,
numjobs=numjobs,
jobs_per_node=jobs_per_node,
maxnodes=(maxnodes-1),
Expand All @@ -176,6 +178,7 @@ def run_slurm(
filepath,
jobname='slurm_job',
partition='savio2',
qos='savio_lowprio',
job_spec=None,
limit=None,
uniqueid='"${SLURM_ARRAY_JOB_ID}"',
Expand All @@ -189,6 +192,7 @@ def run_slurm(
filepath=filepath,
jobname=jobname,
partition=partition,
qos=qos,
job_spec=job_spec,
limit=limit,
uniqueid=uniqueid,
Expand Down Expand Up @@ -363,6 +367,8 @@ def slurm():
'--jobname', '-j', default='test', help='name of the job')
@click.option(
'--partition', '-p', default='savio2', help='resource on which to run')
@click.option(
'--qos', '-q', default='savio_lowprio', help='QOS for job')
@click.option('--dependency', '-d', type=int, multiple=True)
@click.option(
'--logdir', '-L', default='log', help='Directory to write log files')
Expand All @@ -375,6 +381,7 @@ def prep(
jobname='slurm_job',
dependency=None,
partition='savio2',
qos='savio_lowprio',
maxnodes=100,
logdir='log',
uniqueid='"${SLURM_ARRAY_JOB_ID}"'):
Expand All @@ -383,6 +390,7 @@ def prep(
filepath=filepath,
jobname=jobname,
partition=partition,
qos=qos,
job_spec=job_spec,
jobs_per_node=jobs_per_node,
maxnodes=maxnodes,
Expand All @@ -405,30 +413,34 @@ def prep(
'--jobname', '-j', default='test', help='name of the job')
@click.option(
'--partition', '-p', default='savio2', help='resource on which to run')
@click.option(
'--qos', '-q', default='savio_lowprio', help='QOS for job')
@click.option(
'--dependency', '-d', type=int, multiple=True)
@click.option(
'--logdir', '-L', default='log', help='Directory to write log files')
@click.option(
'--uniqueid', '-u', default='"${SLURM_ARRAY_JOB_ID}"',
help='Unique job pool id')

def run(
limit=None,
jobs_per_node=24,
jobname='slurm_job',
dependency=None,
partition='savio2',
qos='savio_lowprio',
maxnodes=100,
logdir='log',
uniqueid='"${SLURM_ARRAY_JOB_ID}"'):

if not os.path.isdir(logdir):
os.makedirs(logdir)

slurm_id = run_slurm(
filepath=filepath,
jobname=jobname,
partition=partition,
qos=qos,
job_spec=job_spec,
jobs_per_node=jobs_per_node,
maxnodes=maxnodes,
Expand All @@ -441,6 +453,7 @@ def run(
filepath=filepath,
jobname=jobname+'_finish',
partition=partition,
qos=qos,
dependencies=('afterany', [slurm_id]),
logdir=logdir,
flags=['cleanup', slurm_id])
Expand Down Expand Up @@ -534,7 +547,6 @@ def do_job(job_name, job_id, num_jobs=None, logdir='log'):
run_job(**job_kwargs)

except (KeyboardInterrupt, SystemExit):

try:
logger.error('{} interupted, removing .lck file before exiting'.format(task_id))
os.remove(lock_file.format('lck'))
Expand Down