jobs
tit.server.routes.jobs ¶
/api/jobs and /api/jobs/groups — thin HTTP wrappers over :mod:tit.jobs.manager.
Every rule that decides whether a job can run (dependencies, locks, budget) lives in
:mod:tit.jobs; this module only translates HTTP into :class:~tit.jobs.manager.JobManager
calls, plus the group/DAG seam into :mod:tit.jobs.plans. /api/jobs/groups covers every
per-subject kind (pre, sim, flex, flex_adaptive, flex_pareto, ex, mex);
the concurrency cap it carries is enforced by the scheduler, never by client-side POST timing.
InputsMissing ¶
Bases: Exception
:func:plan_submission's refusal: response is the route's 422 body as sent.
Source code in tit/server/routes/jobs.py
submit_group ¶
Submit a per-subject job group (R3).
kind=pre expands into tit.jobs.plans.plan_preprocessing's G1-G6/report DAG;
sim/flex/flex_adaptive/flex_pareto/ex/mex expand into one independent
job per (subject, config) entry via tit.jobs.plans.plan_per_subject.
The whole group is created queued in this one request; tit.jobs.scheduler.evaluate() runs one
job per product at a time, so its jobs run one after another. A parallel_subjects field from
an older client is ignored.
subject_configs (optional, additive) carries per-subject resolved configs -- a page whose
config depends on the subject (an ROI resolved against that subject's atlas, a leadfield
path) sends one entry per job instead of one template. Entries are matched to
subject_ids by their subject_id; a subject with no entry uses config. Whatever the
caller sends, each generated config's subject_id is forced to its own subject.
Source code in tit/server/routes/jobs.py
runs_once_for_all_subjects ¶
True when one job of kind with config covers all its subjects (see
:data:ONCE_FOR_ALL_SUBJECTS_KINDS), and for an analyzer config in group mode.
Source code in tit/server/routes/jobs.py
plan_submission ¶
plan_submission(manager: JobManager, kind: str, config: dict[str, Any], subject_ids: list[str], *, subject_configs: Any = None, tags: list[str] | None = None, overwrite: bool = False) -> list[Any]
Every check POST /api/jobs/groups makes, returning the jobs it would submit.
Shared with the proposal engine (:mod:tit.server.proposals), which queues an approved
step through exactly this path. Group kinds expand as :func:submit_group documents; a
config that runs once for all its subjects (:func:runs_once_for_all_subjects) is one job,
as its run page submits it; any other kind becomes one job per subject with that subject's
id in its config (what the agent plugin's submit_job sends to POST /api/jobs).
Raises :class:HTTPException (422/409/501) or :class:InputsMissing.
Source code in tit/server/routes/jobs.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |