plans
tit.jobs.plans ¶
Job-group plans: the preprocessing DAG and the generic per-subject group (TODO.md ยง2.3, G1-G6).
Pure data: this module only describes the DAG a PreprocessConfig + subject list would
produce, as a flat list of :class:tit.jobs.spec.PlannedJob. It never touches the job registry,
the scheduler, or the filesystem beyond what :func:tit.config_io.serialize_config needs (an
active :class:~tit.paths.PathManager, for the project_dir it injects into every stage's
config) -- callers submit the plan themselves (POST /api/jobs/groups, owned by B1, resolves
each PlannedJob.label/after_labels to a real job id in topological order), and notebook
users can call this directly to inspect or hand-tune the DAG before submitting it job by job.
See Also¶
tit.jobs.spec.PlannedJob : The node type this module builds.
tit.pre.structural.run_pipeline : Consumes exactly the flags each stage's config sets.
tit.server.routes.plan : Calls this for POST /api/plan/pre.
plan_per_subject ¶
plan_per_subject(kind: str, subject_configs: list[tuple[str, dict]], *, tags: list[str] | None = None, overwrite: bool = False) -> list[PlannedJob]
One independent :class:PlannedJob per (subject_id, config) entry.
The generic half of POST /api/jobs/groups (R3): unlike pre, a sim/flex/
ex/mex group has no intra-subject DAG -- every job is submittable at once and the
scheduler runs them one at a time (one job per product, :func:tit.jobs.scheduler.evaluate).
Each entry's config is round-tripped through the kind's config dataclass with
subject_id forced to that entry's subject, so a generated config can only ever carry
its own subject id no matter what the caller sent (the gate's config-isolation check).
Parameters¶
kind : str
One of :data:GROUP_KINDS other than "pre".
subject_configs : list of (str, dict)
(subject_id, serialized config) pairs, in submission order. One subject may appear
more than once (the Simulator's one job per (subject, montage)).
tags : list of str, optional
Tags copied onto every planned job.
overwrite : bool, optional
Replace existing output instead of skipping it; copied onto every planned job.
Raises¶
ValueError Unknown/unsupported kind, or a config that does not deserialize for it.
Source code in tit/jobs/plans.py
plan_preprocessing ¶
plan_preprocessing(config: PreprocessConfig, subject_ids: list[str]) -> list[PlannedJob]
Build the per-subject preprocessing job DAG.
Stage groups, in dependency order per subject (a stage is only planned when its
PreprocessConfig flag is set):
G1= DICOM-to-NIfTI conversion (convert_dicom)G2a= SimNIBScharm+subject_atlas(create_m2m), afterG1G2b= FastSurfer--seg_onlydeep segmentation (run_fastsurfer), afterG1-- it reads the raw BIDS T1w, so it needs nothing fromG2aand the two run in parallelG2c= optional FreeSurfer recon-all/subregions, afterG1G3= tissue-volume/thickness analysis (run_tissue_analysis), afterG2aG4= QSIPrep (run_qsiprep), afterG1G5= optional QSIRecon (run_qsirecon), afterG4G6= DTI tensor fit (extract_dti, DIPY on QSIPrep output), afterG4andG2a-- it needs no QSIRecon, so it runs in parallel withG5A report is not a stage and never a job of its own:G2acopies SimNIBS'scharm_report.htmlinto the subject's report folder andG6writes the DTI QC report, each as part of its own step.
Each stage job's config is config with every step flag except its own forced to
False and subject_ids narrowed to the one subject -- consistent with
:func:tit.pre.structural.run_pipeline accepting exactly these flags, and letting
G1/G2a/G2b/G4 (all four have no unmet dependency once G1 is done, or
none at all) run in parallel once the scheduler admits them. skip_existing_outputs /
replace_existing_outputs are global policy flags, not stage flags, and are carried
onto every stage's config unchanged.
Parameters¶
config : PreprocessConfig
The full multi-flag request as built by the UI or a notebook. Its own
subject_ids is not read -- see subject_ids below.
subject_ids : list of str
Subjects to plan for. Kept separate from config.subject_ids so a caller can
plan for a batch chosen after the rest of config is built (e.g. a group picked
in the UI).
Returns¶
list of PlannedJob Flattened across every subject, most-upstream stage first. Empty for a subject with no step flags set at all.
See Also¶
tit.jobs.spec.PlannedJob : label/after_labels are plan-scoped; the real job
manager resolves them to job ids at submission time.
Source code in tit/jobs/plans.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |