Skip to content

Commit ffa5dc0

Browse files
authored
Merge pull request #2240 from effigies/enh/reuse-config
ENH: Reuse config
2 parents 1bbfa00 + 25f610c commit ffa5dc0

File tree

4 files changed

+179
-138
lines changed

4 files changed

+179
-138
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,10 @@ jobs:
653653
- run:
654654
name: Generate report with one artificial error
655655
command: |
656+
set -x
656657
sudo mv /tmp/${DATASET}/derivatives/fmriprep/sub-100185.html \
657658
/tmp/${DATASET}/derivatives/fmriprep/sub-100185_noerror.html
658-
UUID="$(date '+%Y%m%d-%H%M%S_')$(uuidgen)"
659-
mkdir -p /tmp/${DATASET}/derivatives/fmriprep/sub-100185/log/$UUID/
659+
UUID=$(grep uuid /tmp/${DATASET}/work/*/config.toml | cut -d\" -f 2)
660660
cp /tmp/src/fmriprep/fmriprep/data/tests/crash_files/*.txt \
661661
/tmp/${DATASET}/derivatives/fmriprep/sub-100185/log/$UUID/
662662
set +e
@@ -666,7 +666,7 @@ jobs:
666666
/tmp/data/${DATASET} /tmp/${DATASET}/derivatives participant \
667667
--fs-no-reconall --sloppy --write-graph \
668668
--output-spaces MNI152NLin2009cAsym:res-2 anat func \
669-
--reports-only --run-uuid $UUID
669+
--reports-only --config-file /tmp/${DATASET}/work/${UUID}/config.toml -vv
670670
RET=$?
671671
set -e
672672
[[ "$RET" -eq "1" ]]

fmriprep/cli/parser.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ def _bids_filter(value):
318318
)
319319
g_conf.add_argument(
320320
"--random-seed",
321+
dest="_random_seed",
321322
action="store",
322323
type=int,
323324
default=None,
@@ -505,12 +506,11 @@ def _bids_filter(value):
505506
"aggregation, not reportlet generation for specific nodes.",
506507
)
507508
g_other.add_argument(
508-
"--run-uuid",
509+
"--config-file",
509510
action="store",
510-
default=None,
511-
help="Specify UUID of previous run, to include error logs in report. "
512-
"No effect without --reports-only.",
513-
)
511+
metavar="FILE",
512+
help="Use pre-generated configuration file. Values in file will be overridden "
513+
"by command-line arguments.")
514514
g_other.add_argument(
515515
"--write-graph",
516516
action="store_true",
@@ -575,6 +575,12 @@ def parse_args(args=None, namespace=None):
575575

576576
parser = _build_parser()
577577
opts = parser.parse_args(args, namespace)
578+
579+
if opts.config_file:
580+
skip = {} if opts.reports_only else {"execution": ("run_uuid",)}
581+
config.load(opts.config_file, skip=skip)
582+
config.loggers.cli.info(f"Loaded previous configuration file {opts.config_file}")
583+
578584
config.execution.log_level = int(max(25 - 5 * opts.verbose_count, logging.DEBUG))
579585
config.from_dict(vars(opts))
580586

0 commit comments

Comments
 (0)