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():
21
21
from ..utils .sentry import sentry_setup
22
22
sentry_setup ()
23
23
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.
24
27
config_file = config .execution .work_dir / '.fmriprep.toml'
25
28
config .to_filename (config_file )
26
29
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.
28
33
with Manager () as mgr :
29
34
from .workflow import build_workflow
30
35
retval = mgr .dict ()
@@ -35,6 +40,9 @@ def main():
35
40
retcode = p .exitcode or retval .get ('return_code' , 0 )
36
41
fmriprep_wf = retval .get ('workflow' , None )
37
42
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).
38
46
config .load (config_file )
39
47
40
48
if config .execution .reports_only :
Original file line number Diff line number Diff line change 86
86
pass # context has been already set
87
87
finally :
88
88
# Defer all custom import for after initializing the forkserver and
89
- # redirecting warnings
89
+ # ignoring the most annoying warnings
90
90
import os
91
91
import sys
92
92
import logging
You can’t perform that action at this time.
0 commit comments