The tree of dependencies
Each module executes at a particular domain (e.g., once per subject, once per session). The domains are defined by a tree, defined using XML in aap.directory_conventions.parallel_dependencies. This specifies which domains are children of which other domains (e.g., a scanning session is the child of a subject).
Data access for modules is constrained by two rules: (1) A module may neverwrite data at a level higher or sideways in the tree. (2) A module may never readdata sideways in the tree.
When a target module wishes to execute, it must wait for all of the jobs that it is dependent on to complete. Working out which jobs must complete is non-trivial, particularly when they have different domains (e.g., one is run once-per-session and another once-per-subject). The only source modules that a target module can be dependent on are those that provide input streams. If a source module has many jobs executing in parallel, the complexity lies in working out which of these must complete and may provide data. The input and output rules above are critical to this.