Skip to content

Instantly share code, notes, and snippets.

@satra
Created April 12, 2012 01:28
Show Gist options
  • Select an option

  • Save satra/2364105 to your computer and use it in GitHub Desktop.

Select an option

Save satra/2364105 to your computer and use it in GitHub Desktop.
test nipype configuration
import os
from nipype import logging, config
config.set('logging', 'workflow_level', 'DEBUG')
logging.update_logging(config)
from nipype.pipeline.engine import Node, Workflow
from nipype.interfaces.utility import Function
def createtwofiles():
import os
file1 = os.path.abspath('file1')
with open(file1, 'wt') as fp:
fp.writelines('file1')
file2 = os.path.abspath('file2')
with open(file2, 'wt') as fp:
fp.writelines('file2')
return file1, file2
def copyfilehere(infile):
from shutil import copyfile
import os
outfile = os.path.abspath('outfile')
copyfile(infile, outfile)
return outfile
node1 = Node(Function(input_names=[],
output_names=['out1', 'out2'],
function=createtwofiles),
name='create')
node2 = Node(Function(input_names=['infile'],
output_names=['out'],
function=copyfilehere),
name='copy')
wf = Workflow(name='testconfig')
wf.base_dir = os.getcwd()
wf.connect(node1, 'out2', node2, 'infile')
wf.config['execution'] = {'local_hash_check': 'True',
'remove_unnecessary_outputs': 'False'}
wf.run('MultiProc')
120411-21:37:28,738 workflow DEBUG:
networkx 1.4 dev or higher detected
120411-21:37:28,743 workflow DEBUG:
(testconfig.create, testconfig.copy): No edge data
120411-21:37:28,744 workflow DEBUG:
(testconfig.create, testconfig.copy): new edge data: {'connect': [('out2', 'infile')]}
120411-21:37:28,946 workflow DEBUG:
Creating flat graph for workflow: testconfig
120411-21:37:28,949 workflow DEBUG:
expanding workflow: testconfig
120411-21:37:28,950 workflow DEBUG:
processing node: testconfig.create
120411-21:37:28,950 workflow DEBUG:
processing node: testconfig.copy
120411-21:37:28,950 workflow DEBUG:
finished expanding workflow: testconfig
120411-21:37:28,951 workflow INFO:
['check', 'execution', 'logging']
120411-21:37:28,953 workflow DEBUG:
PE: expanding iterables
120411-21:37:28,953 workflow DEBUG:
PE: expanding iterables ... done
120411-21:37:28,955 workflow INFO:
Running in parallel.
120411-21:37:28,957 workflow INFO:
Submitting 1 jobs
120411-21:37:28,957 workflow INFO:
Executing: create ID: 0 H:e008c1e0699ef574fec0c0f11710f6f0
120411-21:37:28,957 workflow DEBUG:
checking hash locally
120411-21:37:28,958 workflow DEBUG:
Hash exists False
120411-21:37:28,958 workflow DEBUG:
Finished checking hash True
120411-21:37:28,964 workflow DEBUG:
Setting node inputs
120411-21:37:28,964 workflow INFO:
Executing node create in dir: /tmp/testconfig/create
120411-21:37:28,964 workflow DEBUG:
Node hash: e008c1e0699ef574fec0c0f11710f6f0
120411-21:37:28,965 workflow DEBUG:
/tmp/testconfig/create/_0xe008c1e0699ef574fec0c0f11710f6f0_unfinished.json found and can_resume is True or Node is a MapNode - resuming execution
120411-21:37:28,965 workflow DEBUG:
Creating /tmp/testconfig/create
120411-21:37:28,965 workflow DEBUG:
writing pre-exec report to /tmp/testconfig/create/_report/report.rst
120411-21:37:28,967 workflow DEBUG:
Executing node
120411-21:37:28,967 workflow DEBUG:
copying files to wd [execute=True, linksonly=False]
120411-21:37:28,970 workflow DEBUG:
Needed files: /tmp/testconfig/create/file1;/tmp/testconfig/create/file2;/tmp/testconfig/create/_0xe008c1e0699ef574fec0c0f11710f6f0_unfinished.json;/tmp/testconfig/create/_inputs.pklz;/tmp/testconfig/create/_node.pklz
120411-21:37:28,970 workflow DEBUG:
Needed dirs: /tmp/testconfig/create/_report
120411-21:37:28,970 workflow DEBUG:
Removing files:
120411-21:37:28,972 workflow DEBUG:
saved results in /tmp/testconfig/create/result_create.pklz
120411-21:37:28,972 workflow DEBUG:
writing post-exec report to /tmp/testconfig/create/_report/report.rst
120411-21:37:28,973 workflow DEBUG:
Finished running create in dir: /tmp/testconfig/create
120411-21:37:30,962 workflow INFO:
[Job finished] jobname: create jobid: 0
120411-21:37:31,12 workflow INFO:
Submitting 1 jobs
120411-21:37:31,13 workflow INFO:
Executing: copy ID: 1 H:933316ea8421862ed50cab9a824c4234
120411-21:37:31,13 workflow DEBUG:
checking hash locally
120411-21:37:31,13 workflow DEBUG:
Hash exists False
120411-21:37:31,13 workflow DEBUG:
Finished checking hash True
120411-21:37:31,15 workflow DEBUG:
Setting node inputs
120411-21:37:31,15 workflow DEBUG:
input: infile
120411-21:37:31,15 workflow DEBUG:
results file: /tmp/testconfig/create/result_create.pklz
120411-21:37:31,18 workflow DEBUG:
output: out2
120411-21:37:31,18 workflow DEBUG:
setting nodelevel(testconfig.copy) input infile = /tmp/testconfig/create/file2
120411-21:37:31,18 workflow INFO:
Executing node copy in dir: /tmp/testconfig/copy
120411-21:37:31,19 workflow DEBUG:
Node hash: 5ca2ff61d87cb4a92049fb578c811808
120411-21:37:31,19 workflow DEBUG:
/tmp/testconfig/copy/_0x5ca2ff61d87cb4a92049fb578c811808_unfinished.json found and can_resume is True or Node is a MapNode - resuming execution
120411-21:37:31,19 workflow DEBUG:
Creating /tmp/testconfig/copy
120411-21:37:31,19 workflow DEBUG:
writing pre-exec report to /tmp/testconfig/copy/_report/report.rst
120411-21:37:31,21 workflow DEBUG:
Executing node
120411-21:37:31,21 workflow DEBUG:
copying files to wd [execute=True, linksonly=False]
120411-21:37:31,22 workflow DEBUG:
Needed files: /tmp/testconfig/copy/outfile;/tmp/testconfig/copy/_0x5ca2ff61d87cb4a92049fb578c811808_unfinished.json;/tmp/testconfig/copy/_inputs.pklz;/tmp/testconfig/copy/_node.pklz
120411-21:37:31,22 workflow DEBUG:
Needed dirs: /tmp/testconfig/copy/_report
120411-21:37:31,23 workflow DEBUG:
Removing files:
120411-21:37:31,24 workflow DEBUG:
saved results in /tmp/testconfig/copy/result_copy.pklz
120411-21:37:31,24 workflow DEBUG:
writing post-exec report to /tmp/testconfig/copy/_report/report.rst
120411-21:37:31,25 workflow DEBUG:
Finished running copy in dir: /tmp/testconfig/copy
120411-21:37:33,16 workflow INFO:
[Job finished] jobname: copy jobid: 1
0.5.3
{'nibabel_version': '1.2.0.dev', 'networkx_version': '1.6', 'numpy_version': '1.6.1', 'sys_platform': 'linux2', 'sys_version': '2.7.2 |CUSTOM| (default, Jul 3 2011, 15:17:51) \n[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]', 'commit_source': 'installation', 'commit_hash': '2672703', 'pkg_path': '/srv/software/python/EPD/virtualenvs/7.2/nipype0.5/lib/python2.7/site-packages/nipype', 'sys_executable': '/srv/software/python/EPD/virtualenvs/7.2/nipype0.5/bin/python', 'traits_version': '4.1.0', 'scipy_version': '0.10.0'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment