Skip to content

Commit af7a645

Browse files
committed
add --work-dir option
1 parent f1785bc commit af7a645

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

scripts/fix_rbc_release_tr.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
--input-dir /path/to/rbc_release --output-dir /path/to/fixed \\
2929
[--participant-label sub-X ...] [--bandpass 0.01 0.1] \\
3030
[--tr-override 2.0] [--runner auto] [--skip-metrics] \\
31-
[--overwrite] [--dry-run | --verify]
31+
[--work-dir /scratch] [--overwrite] [--dry-run | --verify]
3232
3333
Or standalone, no clone::
3434
@@ -620,6 +620,15 @@ def _build_parser() -> argparse.ArgumentParser:
620620
choices=["auto", "local", "docker", "podman", "singularity"],
621621
help="NiWrap runner for AFNI 3dTproject (default: auto).",
622622
)
623+
parser.add_argument(
624+
"--work-dir",
625+
type=Path,
626+
default=None,
627+
help="Parent directory under which to create the (auto-cleaned) scratch "
628+
"folder for patched headers and niwrap exec dirs. Defaults to the "
629+
"system temp dir (honors $TMPDIR/$TEMP/$TMP). Point this at a roomy "
630+
"disk for multi-thousand-run releases.",
631+
)
623632
parser.add_argument(
624633
"--skip-metrics",
625634
action="store_true",
@@ -729,7 +738,11 @@ def main(argv: list[str] | None = None) -> int:
729738

730739
args.output_dir.mkdir(parents=True, exist_ok=True)
731740
atlases: Mapping[str, Path] = {} if args.skip_metrics else _resolve_atlases()
732-
with tempfile.TemporaryDirectory(prefix="rbc_tr_fix_") as work_str:
741+
if args.work_dir is not None:
742+
args.work_dir.mkdir(parents=True, exist_ok=True)
743+
with tempfile.TemporaryDirectory(
744+
prefix="rbc_tr_fix_", dir=args.work_dir
745+
) as work_str:
733746
# Route niwrap exec folders under the same temp root so they get
734747
# cleaned up; else ``generate_exec_folder`` accumulates GBs across
735748
# a multi-thousand-run release.

0 commit comments

Comments
 (0)