Skip to content

Add nipype_crash_search script #1422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
166f209
fix: sge plugin - no zombies at ucsf
akeshavan Apr 4, 2016
eea0b9a
add nipype_crash_search script
alexsavio Apr 7, 2016
a8155e8
Merge remote-tracking branch 'upstream/master' into ucsf_sge
akeshavan Apr 7, 2016
98012c8
fix: removed list_outputs because it isn't needed
akeshavan Apr 11, 2016
66069cd
doc: make check-before-commit
akeshavan Apr 11, 2016
9fd5187
doc: make check-before-commit
akeshavan Apr 11, 2016
34df67c
Added Gitter Sidecar
chrisgorgo Apr 12, 2016
5f06cb8
Merge pull request #1430 from chrisfilo/enh/gitter_sidecar
satra Apr 12, 2016
5330e5c
Merge pull request #1429 from akeshavan/applymask
satra Apr 12, 2016
dba3270
REF: Simplify checkT1s
effigies Apr 12, 2016
0fd5842
fix: segstats avgwf_txt_file can be a bool without error
akeshavan Apr 12, 2016
4005831
Merge remote-tracking branch 'upstream/master' into ucsf_sge
akeshavan Apr 12, 2016
cbd55e2
Merge pull request #1432 from effigies/purge_simpleitk
satra Apr 13, 2016
6b0fbaa
Merge pull request #1433 from akeshavan/segstats
satra Apr 13, 2016
2ce38f4
FIX: Fixes a few flags in for FreeSurfer 5.3
Apr 1, 2016
7a43049
ENH: Print FS version.
Apr 1, 2016
ee7ab69
FIX: Fixes elif syntax error.
Apr 1, 2016
dc8fec3
FIX: Adds stop and shrink to autorecon1.
Apr 1, 2016
c79f559
FIX: Removes entorhinal BA maps for 5.3.
Apr 1, 2016
bfa3c29
FIX: Adds entorhinal to autorecon3
Apr 1, 2016
291bafd
FIX: Removes thresh.perirhinal from 5.3
Apr 1, 2016
4bd4962
FIX: Allows for changing of RB atlas
Apr 1, 2016
c8ddf6d
FIX: Fixes input to config for rb_date
Apr 1, 2016
e81d637
FIX: config function.
Apr 1, 2016
97e1021
FIX: Switches around the intensity normalization for 5.3
Apr 1, 2016
c1f8aed
FIX: fixes connections ar1
Apr 1, 2016
4d16008
FIX: corrects the output for copy_transform
Apr 1, 2016
3d60d7d
FIX: adds item to outpus for autorecon1
Apr 1, 2016
06d5fbc
FIX: Connects 'nu' of autorecon1 to autorecon2.
ellisdg Apr 4, 2016
759f52e
FIX: Takes out new inputs to CALabel.
ellisdg Apr 4, 2016
a6850ce
FIX: Removes in_aseg from ribbon masking.
ellisdg Apr 5, 2016
cd7dc15
ENH: Allows for implicit aseg input in ribbon masking.
ellisdg Apr 5, 2016
c0cf40f
FIX: Fixes typo.
ellisdg Apr 5, 2016
37fd56c
FIX: Fixes source subject for BAMaps thresh.
Apr 6, 2016
1b95329
FIX: Temporary fix for apas2aseg. Will still need to fix what is goin…
Apr 6, 2016
2daa8c1
FIX: Changes reference of labels to source_fields.
Apr 6, 2016
25b7e96
Fix: turns the mandatory flag off for aseg.
Apr 6, 2016
ac60065
FIX: Fixes failure to copy rh.white
Apr 6, 2016
d6560f1
FIX: Adds filled input to Aparc2Aseg.
Apr 6, 2016
9057ffa
FIX: Allows for aseg to be copied in segstats for 5.3.
Apr 6, 2016
1ec5bf0
FIX: Changes presurf_seg to not being mandatory.
Apr 6, 2016
0b6eb84
FIX: Updates WM_Parcellation_Stats to take aseg as input.
Apr 6, 2016
987427a
FIX: Fixes typo when connecting workflows.
Apr 6, 2016
2c1c045
FIX: Fixes error causing sphere.reg to be passed as a label.
Apr 6, 2016
ce8a0df
FIX: Changes orig_nu.mgz to nu.mgz for the input to EM_register.
Apr 7, 2016
7959d40
ENH: Makes mris_make_surfaces compatable with the 5.3 recon-all.
Apr 11, 2016
2c9cb25
FIX: Removes unnecessary step in autorecon2.
Apr 11, 2016
490446e
ENH: Adds in_white to Make Surfaces.
Apr 11, 2016
e262e78
FIX: Switches the format of arguments for mris_make_surfaces to basen…
Apr 11, 2016
5060fdc
FIX: Adds inputs to the copying of aseg_presurf to aseg.mgz.
Apr 11, 2016
6c63ded
FIX: Changes .rsplit to os.path.splittext.
Apr 11, 2016
848442b
FIX: Removes the unnecessary inputs to MakeSurfaces for 53.
Apr 11, 2016
1857064
FIX: Allows the interface wrapper to know it is making a pial surface…
Apr 12, 2016
ede459f
FIX: Adds import statement to output aseg function.
Apr 12, 2016
a2672c8
FIX: Fixes import statement.
Apr 12, 2016
775f1f9
FIX: Adds shutil to import for out_aseg function.
Apr 12, 2016
44f1e29
FIX: Imports os for out_aseg function.
Apr 12, 2016
022352c
FIX: fixes bugs in recoding table workflow.
Apr 12, 2016
f3acecc
FIX: Changes nipype.pipeline.Node to pe.Node
Apr 12, 2016
7050d57
FIX: Changes nipype.Node to pe.Node.
Apr 12, 2016
ccb4b16
FIX: Changes nipype.Function to Function.
Apr 12, 2016
6c9886f
FIX: Replaces nipype.IdentityInterface with niu.IdentityInterface.
Apr 12, 2016
01b84a9
ENH: Removes the relabels hypointensities for 5.3.
Apr 13, 2016
89e208c
FIX: Switches the presurf labelmap name back to aseg.presurf.mgz.
Apr 13, 2016
aaf3b05
FIX: make check-before-commit
Apr 13, 2016
959c57e
FIX: switches incorrect if statement.
Apr 13, 2016
56fbd21
FIX: Fixes aseg input for Aparc2Aseg.
Apr 13, 2016
3cd2fd0
FIX: Adds aseg input for a2009s Aparc2Aseg.
Apr 13, 2016
5644aa2
FIX: Adds stop and shrink values to autorecon2.py to ensure that the
Apr 13, 2016
095e359
FIX: Adds distance to autorecon2.py.
Apr 13, 2016
3f1926c
FIX: Corrected fsvernum if statements to fix 6.0beta workflow.
Apr 14, 2016
f88204e
FIX: Removes duplicate connection.
Apr 14, 2016
58cfc19
FIX: Changes list position of entorhinal.
Apr 15, 2016
816f787
DOC: Updates CHANGES
Apr 15, 2016
6437bf3
FIX: Removes unnecessary methods from smri freesurfer workflow utils.
Apr 15, 2016
c39acaf
FIX: Removes unused functions and imports.
Apr 15, 2016
e99d34d
Merge pull request #1437 from BRAINSia/RemoveSimpleITK
satra Apr 16, 2016
252a2dd
Merge pull request #1423 from akeshavan/ucsf_sge
satra Apr 16, 2016
9faf6f8
Merge remote-tracking branch 'nipype_proper/master' into FreeSurfer53
ellisdg Apr 16, 2016
f6ae4e4
Merge pull request #1434 from BRAINSia/FreeSurfer53
satra Apr 17, 2016
461b17b
add nipype_crash_search script
alexsavio Apr 7, 2016
d767232
add doc for nipype_crash_search
alexsavio Apr 18, 2016
8470be3
Merge remote-tracking branch 'origin/crsrch' into crsrch
alexsavio Apr 18, 2016
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
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Next release
============

* ENH: Add nipype_crash_search command (https://github.com/nipy/nipype/pull/1422)
* ENH: Created interface for BrainSuite Cortical Surface Extraction command line tools (https://github.com/nipy/nipype/pull/1305)
* FIX: job execution on systems/approaches where locale is undefined (https://github.com/nipy/nipype/pull/1401)
* FIX: Clean up byte/unicode issues using subprocess (https://github.com/nipy/nipype/pull/1394)
Expand Down Expand Up @@ -28,6 +29,7 @@ Next release
* FIX: Correct linking/copying fallback behavior (https://github.com/nipy/nipype/pull/1391)
* ENH: Nipype workflow and interfaces for FreeSurfer's recon-all (https://github.com/nipy/nipype/pull/1326)
* FIX: Permit relative path for concatenated_file input to Concatenate() (https://github.com/nipy/nipype/pull/1411)
* ENH: Makes ReconAll workflow backwards compatible with FreeSurfer 5.3.0 (https://github.com/nipy/nipype/pull/1434)

Release 0.11.0 (September 15, 2015)
============
Expand Down
538 changes: 0 additions & 538 deletions CHANGES.orig

This file was deleted.

76 changes: 76 additions & 0 deletions bin/nipype_crash_search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/usr/bin/env python
"""Search for tracebacks inside a folder of nipype crash
log files that match a given regular expression.

Examples:
nipype_crash_search -d nipype/wd/log -r '.*subject123.*'
"""
import re
import os.path as op
from glob import glob

from traits.trait_errors import TraitError
from nipype.utils.filemanip import loadcrash


def load_pklz_traceback(crash_filepath):
""" Return the traceback message in the given crash file."""
try:
data = loadcrash(crash_filepath)
except TraitError as te:
return str(te)
except:
raise
else:
return '\n'.join(data['traceback'])


def iter_tracebacks(logdir):
""" Return an iterator over each file path and
traceback field inside `logdir`.
Parameters
----------
logdir: str
Path to the log folder.

field: str
Field name to be read from the crash file.

Yields
------
path_file: str

traceback: str
"""
crash_files = sorted(glob(op.join(logdir, '*.pkl*')))

for cf in crash_files:
yield cf, load_pklz_traceback(cf)


def display_crash_search(logdir, regex):
rex = re.compile(regex, re.IGNORECASE)
for file, trace in iter_tracebacks(logdir):
if rex.search(trace):
print("-" * len(file))
print(file)
print("-" * len(file))
print(trace)


if __name__ == "__main__":
from argparse import ArgumentParser, RawTextHelpFormatter
defstr = ' (default %(default)s)'
parser = ArgumentParser(prog='nipype_crash_search',
description=__doc__,
formatter_class=RawTextHelpFormatter)
parser.add_argument('-l','--logdir', type=str, dest='logdir',
action="store", default=None,
help='The working directory log file.' + defstr)
parser.add_argument('-r', '--regex', dest='regex',
default='*',
help='Regular expression to be searched in each traceback.' + defstr)

args = parser.parse_args()

display_crash_search(args.logdir, args.regex)
6 changes: 6 additions & 0 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
ga('create', 'UA-339450-7', 'nipy.org/nipype');
ga('send', 'pageview');
</script>
<script>
((window.gitter = {}).chat = {}).options = {
room: 'nipy/nipype'
};
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
{% endblock %}

{% block header %}
Expand Down
3 changes: 3 additions & 0 deletions doc/users/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ performance issues.
#. All Nipype crashfiles can be inspected with the `nipype_display_crash`
utility.

#. The `nipype_crash_search` command allows you to search for regular expressions
in the tracebacks of the Nipype crashfiles within a log folder.

#. Nipype determines the hash of the input state of a node. If any input
contains strings that represent files on the system path, the hash evaluation
mechanism will determine the timestamp or content hash of each of those
Expand Down
16 changes: 10 additions & 6 deletions nipype/interfaces/freesurfer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,9 @@ def _list_outputs(self):

def _format_arg(self, name, spec, value):
if name in ('summary_file', 'avgwf_txt_file'):
if not os.path.isabs(value):
value = os.path.join('.', value)
if not isinstance(value, bool):
if not os.path.isabs(value):
value = os.path.join('.', value)
if name in ['avgwf_txt_file', 'avgwf_file', 'sf_avg_file']:
if isinstance(value, bool):
fname = self._list_outputs()[name]
Expand All @@ -779,7 +780,7 @@ class SegStatsReconAllInputSpec(SegStatsInputSpec):
# implicit
ribbon = traits.File(mandatory=True, exists=True,
desc="Input file mri/ribbon.mgz")
presurf_seg = File(mandatory=True, exists=True,
presurf_seg = File(exists=True,
desc="Input segmentation volume")
transform = File(mandatory=True, exists=True,
desc="Input transform file")
Expand All @@ -795,6 +796,8 @@ class SegStatsReconAllInputSpec(SegStatsInputSpec):
desc="Input file must be <subject_id>/surf/lh.pial")
rh_pial = File(mandatory=True, exists=True,
desc="Input file must be <subject_id>/surf/rh.pial")
aseg = File(exists=True,
desc="Mandatory implicit input in 5.3")
copy_inputs = traits.Bool(desc="If running as a node, set this to True " +
"otherwise, this will copy the implicit inputs " +
"to the node directory.")
Expand Down Expand Up @@ -858,7 +861,7 @@ def run(self, **inputs):
copy2subjdir(self, self.inputs.lh_white,
'surf', 'lh.white')
copy2subjdir(self, self.inputs.rh_white,
'Surf', 'Rh.White')
'surf', 'rh.white')
copy2subjdir(self, self.inputs.lh_pial,
'surf', 'lh.pial')
copy2subjdir(self, self.inputs.rh_pial,
Expand All @@ -867,12 +870,13 @@ def run(self, **inputs):
'mri', 'ribbon.mgz')
copy2subjdir(self, self.inputs.presurf_seg,
'mri', 'aseg.presurf.mgz')
copy2subjdir(self, self.inputs.aseg,
'mri', 'aseg.mgz')
copy2subjdir(self, self.inputs.transform,
os.path.join('mri', 'transforms'),
'talairach.xfm')
copy2subjdir(self, self.inputs.in_intensity, 'mri')
if isdefined(self.inputs.brainmask_file):
copy2subjdir(self, self.inputs.brainmask_file, 'mri')
copy2subjdir(self, self.inputs.brainmask_file, 'mri')
return super(SegStatsReconAll, self).run(**inputs)


Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/freesurfer/tests/test_auto_Aparc2Aseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_Aparc2Aseg_inputs():
environ=dict(nohash=True,
usedefault=True,
),
filled=dict(),
hypo_wm=dict(argstr='--hypo-as-wm',
mandatory=False,
),
Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/freesurfer/tests/test_auto_Curvature.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_Curvature_inputs():
usedefault=True,
),
in_file=dict(argstr='%s',
copyfile=True,
mandatory=True,
position=-2,
),
Expand Down
3 changes: 3 additions & 0 deletions nipype/interfaces/freesurfer/tests/test_auto_MakeSurfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_MakeSurfaces_inputs():
in_orig=dict(argstr='-orig %s',
mandatory=True,
),
in_white=dict(),
in_wm=dict(mandatory=True,
),
longitudinal=dict(argstr='-long',
Expand Down Expand Up @@ -66,6 +67,8 @@ def test_MakeSurfaces_inputs():
subjects_dir=dict(),
terminal_output=dict(nohash=True,
),
white=dict(argstr='-white %s',
),
white_only=dict(argstr='-whiteonly',
mandatory=False,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_SegStatsReconAll_inputs():
),
args=dict(argstr='%s',
),
aseg=dict(),
avgwf_file=dict(argstr='--avgwfvol %s',
),
avgwf_txt_file=dict(argstr='--avgwf %s',
Expand Down Expand Up @@ -85,8 +86,7 @@ def test_SegStatsReconAll_inputs():
),
partial_volume_file=dict(argstr='--pv %s',
),
presurf_seg=dict(mandatory=True,
),
presurf_seg=dict(),
rh_orig_nofix=dict(mandatory=True,
),
rh_pial=dict(mandatory=True,
Expand Down
3 changes: 3 additions & 0 deletions nipype/interfaces/freesurfer/tests/test_auto_VolumeMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
def test_VolumeMask_inputs():
input_map = dict(args=dict(argstr='%s',
),
aseg=dict(xor=['in_aseg'],
),
copy_inputs=dict(mandatory=False,
),
environ=dict(nohash=True,
Expand All @@ -16,6 +18,7 @@ def test_VolumeMask_inputs():
),
in_aseg=dict(argstr='--aseg_name %s',
mandatory=False,
xor=['aseg'],
),
left_ribbonlabel=dict(argstr='--label_left_ribbon %d',
mandatory=True,
Expand Down
Loading