Skip to content

Commit c10f2a8

Browse files
author
bpinsard
committed
Merge branch 'master' into spm/reslicetoref
* master: Put units into descr. FIX: strip extraneous whitespace in trait desc Added note about PBS optional argument for maximum jobname length. BF: moment parameter was ignored. Fixed variable name in PBS plugin. Now works. Changes to PBS pipeline plugin. Added a maximum length to the jobname, using a default value of 15 corresponding to the Torque maximum. Modified the config file to do a local hash check by default. fix: avoid stopping of nipype-workflow caused by temporarily suspended LSF-jobs, And changed logfile of lsf-jobs from <lsf_jobid>.out to <scriptname>.log Added FSL output type NIFTI to dmri mrtrix example
2 parents 0d0ad7e + f368be8 commit c10f2a8

File tree

9 files changed

+37
-16
lines changed

9 files changed

+37
-16
lines changed

doc/users/config_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Execution
9595
Perform the hash check on the job submission machine. This option minimizes
9696
the number of jobs submitted to a cluster engine or a multiprocessing pool
9797
to only those that need to be rerun. (possible values: ``true`` and
98-
``false``; default value: ``false``)
98+
``false``; default value: ``true``)
9999

100100
*job_finished_timeout*
101101
When batch jobs are submitted through, SGE/PBS/Condor they could be killed

doc/users/plugins.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Optional arguments::
114114

115115
template: custom template file to use
116116
qsub_args: any other command line args to be passed to qsub.
117+
max_jobname_len: (PBS only) maximum length of the job name. Default 15.
117118

118119
For example, the following snippet executes the workflow on myqueue with
119120
a custom template::

examples/dmri_mrtrix_dti.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import nipype.algorithms.misc as misc
2828
import os, os.path as op # system functions
2929

30+
fsl.FSLCommand.set_default_output_type('NIFTI')
31+
3032
"""
3133
This needs to point to the fdt folder you can find after extracting
3234

nipype/algorithms/misc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ def calc_moments(timeseries_file, moment):
10361036
"""
10371037
timeseries = np.genfromtxt(timeseries_file)
10381038

1039-
moment = 3
10401039
m2 = stats.moment(timeseries, 2, axis=0)
10411040
m3 = stats.moment(timeseries, moment, axis=0)
10421041
zero = (m2 == 0)

nipype/interfaces/base.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import datetime
1414
import errno
1515
import os
16+
import re
1617
from socket import gethostname
1718
from string import Template
1819
import select
@@ -703,27 +704,37 @@ def _get_trait_desc(self, inputs, name, spec):
703704
requires = spec.requires
704705

705706
manhelpstr = ['\t%s' % name]
707+
706708
try:
707709
setattr(inputs, name, None)
708710
except TraitError as excp:
709711
def_val = ''
710712
if getattr(spec, 'usedefault'):
711-
def_val = ', nipype default value: %s' % str(getattr(spec, 'default_value')()[1])
713+
def_arg = getattr(spec, 'default_value')()[1]
714+
def_val = ', nipype default value: %s' % def_arg
712715
line = "(%s%s)" % (excp.info, def_val)
713-
manhelpstr = wrap(line, 90, initial_indent=manhelpstr[0]+': ',
716+
manhelpstr = wrap(line, 70,
717+
initial_indent=manhelpstr[0]+': ',
714718
subsequent_indent='\t\t ')
719+
715720
if desc:
716721
for line in desc.split('\n'):
717-
manhelpstr += wrap(line, 90, initial_indent='\t\t',
722+
line = re.sub("\s+", " ", line)
723+
manhelpstr += wrap(line, 70,
724+
initial_indent='\t\t',
718725
subsequent_indent='\t\t')
726+
719727
if xor:
720728
line = '%s' % ', '.join(xor)
721-
manhelpstr += wrap(line, 90, initial_indent='\t\tmutually_exclusive: ',
729+
manhelpstr += wrap(line, 70,
730+
initial_indent='\t\tmutually_exclusive: ',
722731
subsequent_indent='\t\t ')
723-
if requires: # and name not in xor_done:
732+
733+
if requires:
724734
others = [field for field in requires if field != name]
725735
line = '%s' % ', '.join(others)
726-
manhelpstr += wrap(line, 90, initial_indent='\t\trequires: ',
736+
manhelpstr += wrap(line, 70,
737+
initial_indent='\t\trequires: ',
727738
subsequent_indent='\t\t ')
728739
return manhelpstr
729740

nipype/interfaces/fsl/maths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ class MaxImage(MathsCommand):
143143
class IsotropicSmoothInput(MathsInput):
144144

145145
fwhm = traits.Float(mandatory=True, xor=["sigma"], position=4, argstr="-s %.5f",
146-
desc="fwhm of smoothing kernel")
146+
desc="fwhm of smoothing kernel [mm]")
147147
sigma = traits.Float(mandatory=True, xor=["fwhm"], position=4, argstr="-s %.5f",
148-
desc="sigma of smoothing kernel")
148+
desc="sigma of smoothing kernel [mm]")
149149

150150

151151
class IsotropicSmooth(MathsCommand):

nipype/pipeline/plugins/lsf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def _is_pending(self, taskid):
5252
result = cmd.run(ignore_exception=True)
5353
iflogger.setLevel(oldlevel)
5454
# logger.debug(result.runtime.stdout)
55-
if 'PEND' in result.runtime.stdout or 'RUN' in result.runtime.stdout:
56-
return True
57-
else:
55+
if 'DONE' in result.runtime.stdout or 'EXIT' in result.runtime.stdout:
5856
return False
57+
else:
58+
return True
5959

6060
def _submit_batchtask(self, scriptfile, node):
6161
cmd = CommandLine('bsub', environ=os.environ.data,
@@ -71,9 +71,9 @@ def _submit_batchtask(self, scriptfile, node):
7171
else:
7272
bsubargs += (" " + node.plugin_args['bsub_args'])
7373
if '-o' not in bsubargs: # -o outfile
74-
bsubargs = '%s -o %s' % (bsubargs, path)
74+
bsubargs = '%s -o %s' % (bsubargs, scriptfile + ".log")
7575
if '-e' not in bsubargs:
76-
bsubargs = '%s -e %s' % (bsubargs, path) # -e error file
76+
bsubargs = '%s -e %s' % (bsubargs, scriptfile + ".log") # -e error file
7777
if node._hierarchy:
7878
jobname = '.'.join((os.environ.data['LOGNAME'],
7979
node._hierarchy,

nipype/pipeline/plugins/pbs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,27 @@ class PBSPlugin(SGELikeBatchManagerBase):
1919
- template : template to use for batch job submission
2020
- qsub_args : arguments to be prepended to the job execution script in the
2121
qsub call
22+
- max_jobname_len: maximum length of the job name. Default 15.
2223
2324
"""
2425

26+
# Addtional class variables
27+
_max_jobname_len = 15
28+
2529
def __init__(self, **kwargs):
2630
template = """
2731
#PBS -V
2832
"""
2933
self._retry_timeout = 2
3034
self._max_tries = 2
35+
self._max_jobname_length = 15
3136
if 'plugin_args' in kwargs and kwargs['plugin_args']:
3237
if 'retry_timeout' in kwargs['plugin_args']:
3338
self._retry_timeout = kwargs['plugin_args']['retry_timeout']
3439
if 'max_tries' in kwargs['plugin_args']:
3540
self._max_tries = kwargs['plugin_args']['max_tries']
41+
if 'max_jobname_len' in kwargs['plugin_args']:
42+
self._max_jobname_len = kwargs['plugin_args']['max_jobname_len']
3643
super(PBSPlugin, self).__init__(template, **kwargs)
3744

3845
def _is_pending(self, taskid):
@@ -71,6 +78,7 @@ def _submit_batchtask(self, scriptfile, node):
7178
jobnameitems = jobname.split('.')
7279
jobnameitems.reverse()
7380
jobname = '.'.join(jobnameitems)
81+
jobname = jobname[0:self._max_jobname_len]
7482
cmd.inputs.args = '%s -N %s %s' % (qsubargs,
7583
jobname,
7684
scriptfile)

nipype/utils/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
hash_method = timestamp
3737
job_finished_timeout = 5
3838
keep_inputs = false
39-
local_hash_check = false
39+
local_hash_check = true
4040
matplotlib_backend = Agg
4141
plugin = Linear
4242
remove_node_directories = false

0 commit comments

Comments
 (0)