Skip to content

Commit

Permalink
Allow configuring SLURM's srun command.
Browse files Browse the repository at this point in the history
This can be done in the same way `sbatch` can be configured (i.e., by
giving an alternate path to the binary and additional arguments).
  • Loading branch information
riccardomurri committed Apr 18, 2018
1 parent f2e16dd commit fca92d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/users/configuration.rst
Expand Up @@ -630,7 +630,9 @@ resource manager. By default these commands are searched using the
these commands and/or add some extra options. The following options
are used by the SLURM backend:

* ``sbatch``: submit a job.
* ``sbatch``: submit a job; can specify additional arguments (they will be inserted between the ``sbatch`` invocation and the GC3Pie-provided options)

* ``srun``: run a job's payload; can specify additional arguments (they will be inserted between the ``srun`` invocation and the GC3Pie-provided options)

* ``scancel``: cancel a job.

Expand Down
4 changes: 3 additions & 1 deletion gc3libs/__init__.py
Expand Up @@ -1498,7 +1498,9 @@ def sbatch(self, resource, **extra_args):
'--cpus-per-task', ('%d' % self.requested_cores)]
# we have to run the command through `srun` otherwise
# SLURM launches every task as a single-CPU
cmdline = ['srun', '--cpus-per-task', ('%d' % self.requested_cores)] + cmdline
cmdline = (list(resource.srun)
+ ['--cpus-per-task', ('%d' % self.requested_cores)]
+ cmdline)
if self.requested_memory:
# SLURM uses `mem_free` for memory limits;
# 'M' suffix allowed for Megabytes
Expand Down
3 changes: 2 additions & 1 deletion gc3libs/backends/slurm.py
Expand Up @@ -3,7 +3,7 @@
"""
Job control on SLURM clusters (possibly connecting to the front-end via SSH).
"""
# Copyright (C) 2012-2016 S3IT, Zentrale Informatik, University of Zurich. All rights reserved.
# Copyright (C) 2012-2016, 2018 University of Zurich. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -126,6 +126,7 @@ def __init__(self, name,

# backend-specific setup
self.sbatch = self._get_command_argv('sbatch')
self.srun = self._get_command_argv('srun')

# SLURM commands
self._scancel = self._get_command('scancel')
Expand Down

0 comments on commit fca92d5

Please sign in to comment.