Created
February 14, 2011 22:36
-
-
Save satra/826734 to your computer and use it in GitHub Desktop.
Displays nipype crash files with formatted information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import argparse | |
from nipype.utils.filemanip import loadcrash | |
def display_crash_files(crashfile, rerun): | |
"display crash file content and rerun if required" | |
crash_data = loadcrash(crashfile) | |
node = crash_data['node'] | |
tb = crash_data['traceback'] | |
print "\n" | |
print "File: %s"%crashfile | |
print "Node: %s"%node | |
if node.base_dir: | |
print "Working directory: %s"%node.output_dir() | |
else: | |
print "Node crashed before execution" | |
print "\n" | |
print "Node inputs:" | |
print node.inputs | |
print "\n" | |
print "Traceback: " | |
print ''.join(tb) | |
print "\n" | |
if rerun: | |
print "Rerunning node" | |
node.base_dir = None | |
node.config['crashdump_dir'] = '/tmp' | |
node.run() | |
print "\n" | |
if __name__ == "__main__": | |
docstr= ''' | |
Display crash information from a nipype crash file | |
''' | |
parser = argparse.ArgumentParser(prog='display_crash.py', | |
description=docstr) | |
parser.add_argument('crashfile', metavar='f', type=str, | |
help='crash file to display') | |
parser.add_argument('-r','--rerun', dest='rerun', | |
default=False, action="store_true", | |
help='rerun crashed node') | |
args = parser.parse_args() | |
display_crash_files(args.crashfile, args.rerun) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment