diff --git a/docs/users/configuration.rst b/docs/users/configuration.rst index 059f3490..d177c7c7 100644 --- a/docs/users/configuration.rst +++ b/docs/users/configuration.rst @@ -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. diff --git a/gc3libs/__init__.py b/gc3libs/__init__.py index 6f915f29..8cf39203 100755 --- a/gc3libs/__init__.py +++ b/gc3libs/__init__.py @@ -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 diff --git a/gc3libs/backends/slurm.py b/gc3libs/backends/slurm.py index dfae1dcc..5aaca65b 100755 --- a/gc3libs/backends/slurm.py +++ b/gc3libs/backends/slurm.py @@ -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 @@ -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')