Nipype gives you many liberties on how to create workflows, but the execution of them uses a lot of default parameters. But you have of course all the freedom to change them as you like.
Nipype looks for the configuration options in the local folder under the name nipype.cfg
and in ~/.nipype/nipype.cfg
(in this order). It can be divided into Logging and Execution options. A few of the possible options are the following:
For the full list, see Configuration File.
In [4]:
from nipype import config, logging
import os
os.makedirs('/output/log_folder', exist_ok=True)
os.makedirs('/output/crash_folder', exist_ok=True)
config_dict={'execution': {'remove_unnecessary_outputs': 'true',
'keep_inputs': 'false',
'poll_sleep_duration': '60',
'stop_on_first_rerun': 'false',
'hash_method': 'timestamp',
'local_hash_check': 'true',
'create_report': 'true',
'crashdump_dir': '/output/crash_folder',
'use_relative_paths': 'false',
'job_finished_timeout': '5'},
'logging': {'workflow_level': 'INFO',
'filemanip_level': 'INFO',
'interface_level': 'INFO',
'log_directory': '/output/log_folder',
'log_to_file': 'true'}}
config.update_config(config_dict)
logging.update_logging(config)
In [5]:
from nipype import Workflow
wf = Workflow(name="config_test")
# Change execution parameters
wf.config['execution']['stop_on_first_crash'] = 'true'
# Change logging parameters
wf.config['logging'] = {'workflow_level' : 'DEBUG',
'filemanip_level' : 'DEBUG',
'interface_level' : 'DEBUG',
'log_to_file' : 'True',
'log_directory' : '/output/log_folder'}
In [6]:
from nipype import Node
from nipype.interfaces.fsl import BET
bet = Node(BET(), name="config_test")
bet.config = {'execution': {'keep_unnecessary_outputs': 'false'}}
In [ ]: