Skip to content

Commit a094a91

Browse files
author
Chad Cumba
committed
Organizational changes per Satrajit's requests.
Removed base.py slurm base class and instead rolled it all into slurm.py SLURMPlugin class, which now inherits SGELikeBatchManagerBase. Also changed the default queue time to 1 hour as users did not like default 48 hour queuing.
1 parent cba1f5a commit a094a91

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

nipype/pipeline/plugins/base.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -593,22 +593,7 @@ def _submit_graph(self, pyfiles, dependencies, nodes):
593593
"""
594594
raise NotImplementedError
595595

596-
class SLURMLikeBatchManagerBase(SGELikeBatchManagerBase):
597-
"""Execute workflow with SLURM like batch system
598-
"""
599596

600-
def __init__(self, template, plugin_args=None):
601-
super(SLURMLikeBatchManagerBase, self).__init__(template=template, plugin_args=plugin_args)
602-
self._template = template
603-
self._sbatch_args = None
604-
if plugin_args:
605-
if 'template' in plugin_args:
606-
self._template = plugin_args['template']
607-
if os.path.isfile(self._template):
608-
self._template = open(self._template).read()
609-
if 'sbatch_args' in plugin_args:
610-
self._sbatch_args = plugin_args['sbatch_args']
611-
self._pending = {}
612597

613598
def _get_result(self, taskid):
614599
if taskid not in self._pending:

nipype/pipeline/plugins/slurm.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
import subprocess
1212
from time import sleep
1313

14-
from .base import (SLURMLikeBatchManagerBase, logger, iflogger, logging)
14+
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
1515

1616
from nipype.interfaces.base import CommandLine
1717

1818

19+
1920

20-
21-
class SLURMPlugin(SLURMLikeBatchManagerBase):
21+
class SLURMPlugin(SGELikeBatchManagerBase):
2222
'''
2323
Execute using SLURM
2424
@@ -39,11 +39,21 @@ def __init__(self, **kwargs):
3939
"""
4040
self._retry_timeout = 2
4141
self._max_tries = 2
42+
self._template = template
43+
self._sbatch_args = None
44+
4245
if 'plugin_args' in kwargs and kwargs['plugin_args']:
4346
if 'retry_timeout' in kwargs['plugin_args']:
4447
self._retry_timeout = kwargs['plugin_args']['retry_timeout']
4548
if 'max_tries' in kwargs['plugin_args']:
4649
self._max_tries = kwargs['plugin_args']['max_tries']
50+
if 'template' in kwargs['plugin_args']:
51+
self._template = kwargs['plugin_args']['template']
52+
if os.path.isfile(self._template):
53+
self._template = open(self._template).read()
54+
if 'sbatch_args' in kwargs['plugin_args']:
55+
self._sbatch_args = kwargs['plugin_args']['sbatch_args']
56+
self._pending = {}
4757
super(SLURMPlugin, self).__init__(template, **kwargs)
4858

4959
def _is_pending(self, taskid):
@@ -82,7 +92,7 @@ def _submit_batchtask(self, scriptfile, node):
8292
if '-n' not in sbatch_args:
8393
sbatch_args = '%s -n 16' % (sbatch_args)
8494
if '-t' not in sbatch_args:
85-
sbatch_args = '%s -t 48:00:00' % (sbatch_args)
95+
sbatch_args = '%s -t 1:00:00' % (sbatch_args)
8696
if node._hierarchy:
8797
jobname = '.'.join((os.environ.data['LOGNAME'],
8898
node._hierarchy,

0 commit comments

Comments
 (0)