nipype — Nipype execution settings#

Schema: NipypeConfig in src/thesis/core/config/validators.py. Drives NipypeExecutor and the global nipype.config overrides.

Field

Type

Default

Description

working_dir

Path

work

Base working directory. Each patient workflow gets a <working_dir>/<patient_id>/ subdirectory. Processed through to_path() (supports ~, $VAR).

crash_dir

Path | None

None

Optional crash-dump directory. When unset, Nipype defaults apply.

plugin

str

"MultiProc"

Nipype execution plugin (MultiProc, Linear, SGE, PBS, …).

plugin_args

Dict[str, Any]

{}

Plugin arguments passed to workflow.run(). Common keys: n_procs, memory_gb, n_gpu_procs, n_gpus. The CLI auto-injects hardware.* and --max-workers values when not already set.

stop_on_first_crash

bool

False

Stop execution after the first crashed node.

remove_unnecessary_outputs

bool

True

Have Nipype clean intermediate outputs after workflow completion.

keep_inputs

bool

True

Keep input files in the node working directories.

hash_method

str

"content"

Caching hash strategy. content re-hashes file contents (slower, robust); timestamp uses mtime (faster, fragile). content is required for reliable cache reuse across batch retries.

use_profiler

bool

False

Enable Nipype’s resource profiler.

Example#

nipype:
  working_dir: work
  crash_dir: work/crashes
  plugin: MultiProc
  plugin_args:
    n_procs: 8
    memory_gb: 32
  stop_on_first_crash: false
  remove_unnecessary_outputs: true
  keep_inputs: true
  hash_method: content
  use_profiler: false

Notes#

  • Both per-workflow execution (via NipypeExecutor) and the batch meta-workflow path (in cli.py) call apply_nipype_execution_config(), which writes the relevant settings into the global nipype.config. Without that, file-input hashing falls back to Nipype’s defaults — keep hash_method: content and let the framework apply the global update.

  • The batch path also calls build_nipype_status_callback() to translate node start/finish/failure events into the structured CLI progress UI.

  • When --max-workers N (or -j N) is passed, the CLI sets plugin_args["n_procs"] = N, overriding any YAML value.

  • When hardware.gpu_enabled: true, the CLI sets plugin_args.setdefault("n_gpu_procs", hardware.n_gpu_procs) and plugin_args.setdefault("n_gpus", hardware.n_gpus).