File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,15 @@ def main():
2121 from ..utils .sentry import sentry_setup
2222 sentry_setup ()
2323
24+ # CRITICAL Save the config to a file. This is necessary because the execution graph
25+ # is built as a separate process to keep the memory footprint low. The most
26+ # straightforward way to communicate with the child process is via the filesystem.
2427 config_file = config .execution .work_dir / '.fmriprep.toml'
2528 config .to_filename (config_file )
2629
27- # Call build_workflow(config_file, retval) in a subprocess
30+ # CRITICAL Call build_workflow(config_file, retval) in a subprocess.
31+ # Because Python on Linux does not ever free virtual memory (VM), running the
32+ # workflow construction jailed within a process preempts excessive VM buildup.
2833 with Manager () as mgr :
2934 from .workflow import build_workflow
3035 retval = mgr .dict ()
@@ -35,6 +40,9 @@ def main():
3540 retcode = p .exitcode or retval .get ('return_code' , 0 )
3641 fmriprep_wf = retval .get ('workflow' , None )
3742
43+ # CRITICAL Load the config from the file. This is necessary because the ``build_workflow``
44+ # function executed constrained in a process may change the config (and thus the global
45+ # state of fMRIPrep).
3846 config .load (config_file )
3947
4048 if config .execution .reports_only :
Original file line number Diff line number Diff line change 8686 pass # context has been already set
8787finally :
8888 # Defer all custom import for after initializing the forkserver and
89- # redirecting warnings
89+ # ignoring the most annoying warnings
9090 import os
9191 import sys
9292 import logging
You can’t perform that action at this time.
0 commit comments