exlab_wizard.controller.creation#
Creation controller. Backend Spec §4.4.1, §4.7, §4.8.
Composes the validator, template engine, plugin host, cache writers,
README generator, and NAS sync client into the §4.7 state machine,
driving each session from SessionState.PENDING through to
SessionState.DONE (or SessionState.FAILED /
SessionState.ABORTED on failure / cancel).
Validation gate (UI-spec §2). Before transitioning out of
SessionState.VALIDATING the controller enforces the mandatory
core-field set:
labelnon-empty after trim, ≤ 100 chars.operatornon-empty after trim; allowlisted whenconfig.operators.allowlistis non-empty.objectivenon-empty after trim, ≤ 2000 chars.equipment_idis inconfig.equipment.For runs,
project_short_idmatchesPROJECT_SHORT_ID_PATTERN.Template-required field ids and config-required field ids are all present in
readme_extra.
ReadmeGenerator and NASSyncClient are injected as Protocols so this
phase ships before Phase 8 / Phase 10 land their concrete
implementations. NoOpReadmeGenerator writes a minimal
README.md that the post-validate pass can scan;
NoOpNASSync is a true no-op (the sync queue is built in
Phase 10).
Classes
|
Drives the §4.7 state machine end-to-end. |
|
The NAS sync surface the controller depends on. |
No-op stand-in for |
|
Minimal README generator used until Phase 8 lands the real one. |
|
|
Inputs for |
|
Inputs handed to the README generator. |
|
The README generator surface the controller depends on. |
|
Inputs for |
|
Snapshot of session state. |
- class exlab_wizard.controller.creation.CreationController(*, config, validator, template_engine, plugin_host, cache_creation, cache_equipment, cache_log=None, readme_generator=None, nas_sync=None, session_store=None)[source]#
Bases:
objectDrives the §4.7 state machine end-to-end.
Composes the validator (Phase 4), template engine (Phase 5), plugin host (Phase 6), cache writers (Phase 3), README generator (Phase 8 – NoOp until then), and NAS sync client (Phase 10 – NoOp until then).
- Parameters:
config (
Config)validator (
Validator)template_engine (
TemplateEngine)plugin_host (
PluginHost|None)cache_creation (
CreationWriter)cache_equipment (
EquipmentCacheWriter)readme_generator (
ReadmeGeneratorProtocol|None)nas_sync (
NASSyncProtocol|None)session_store (
SessionStore|None)
- async cancel(session_id, *, discard_files=False)[source]#
Abort an in-flight session.
Pushes a
Noneonto the resume queue (so anINPUT_REQUIREDsession wakes immediately), cancels the pipeline task, and runs the cleanup hook.discard_filesdeletes the partially-created directory; otherwise the directory is left in place as an orphan (Backend Spec §4.7 / §4.8).
- async create_project(req)[source]#
Open a project-creation session and start the pipeline.
The session is registered with the store immediately and the pipeline runs as a background asyncio task; the returned
SessionHandlereflects the post-VALIDATING state. Failures from the validation gate transition the session toFAILEDsynchronously before returning – so the caller can detect them on the very first response.- Parameters:
req (
ProjectCreateRequest)- Return type:
- async create_run(req)[source]#
Open a run-creation session and start the pipeline.
- Parameters:
req (
RunCreateRequest)- Return type:
- async resume(session_id, extra_inputs)[source]#
Supply
extra_inputsafter aPluginInputRequiredprompt.Pushes the payload onto the session’s resume queue; the suspended pipeline wakes, re-spawns the trigger plugin’s worker with the new inputs, and continues. Backend Spec §4.7 / §6.4.
- Parameters:
- Return type:
- property session_store: SessionStore#
Expose the in-memory session store for the API surface.
- async status(session_id)[source]#
Return a snapshot
SessionHandleforsession_id.- Parameters:
session_id (
str)- Return type:
- class exlab_wizard.controller.creation.NASSyncProtocol(*args, **kwargs)[source]#
Bases:
ProtocolThe NAS sync surface the controller depends on. Phase 10.
- class exlab_wizard.controller.creation.NoOpNASSync[source]#
Bases:
objectNo-op stand-in for
NASSyncClientuntil Phase 10 lands.
- class exlab_wizard.controller.creation.NoOpReadmeGenerator[source]#
Bases:
objectMinimal README generator used until Phase 8 lands the real one.
Writes a tiny
README.mdcontaining only the core fields so the post-validate pass has something to scan.- async generate(dst, ctx)[source]#
- Parameters:
dst (
Path)ctx (
ReadmeContext)
- Return type:
- class exlab_wizard.controller.creation.ProjectCreateRequest(equipment_id, template_path, lims_project, variables, label, operator, objective, readme_extra=<factory>)[source]#
Bases:
objectInputs for
CreationController.create_project().Backend Spec §4.6.1 / UI-spec §3.1.
lims_projectmirrors the §11.3lims_projectblock (uid,short_id,name_at_creation,source).- Parameters:
- class exlab_wizard.controller.creation.ReadmeContext(label, operator, objective, equipment_id, project_short_id, run_kind, variables, template, extra_fields=<factory>)[source]#
Bases:
objectInputs handed to the README generator. Phase 8 owns the canonical type; this lightweight stand-in lets Phase 7 ship before Phase 8 lands.
- Parameters:
- template: ResolvedTemplate#
- class exlab_wizard.controller.creation.ReadmeGeneratorProtocol(*args, **kwargs)[source]#
Bases:
ProtocolThe README generator surface the controller depends on. Phase 8.
- async generate(dst, ctx)[source]#
- Parameters:
dst (
Path)ctx (
ReadmeContext)
- Return type:
- class exlab_wizard.controller.creation.RunCreateRequest(equipment_id, project_short_id, template_path, run_kind, variables, label, operator, objective, readme_extra=<factory>, run_date=None, lims_project=<factory>)[source]#
Bases:
objectInputs for
CreationController.create_run().Backend Spec §4.6.1 / UI-spec §3.2 / §3.3.
run_kindis the core mode flag and is immutable mid-session per UI-spec §3.3.- Parameters:
- run_kind: RunKind#
- class exlab_wizard.controller.creation.SessionHandle(session_id, state, current_phase, next_action)[source]#
Bases:
objectSnapshot of session state. Backend Spec §4.4.1.
- Parameters:
session_id (
str)state (
SessionState)next_action (
str)
- state: SessionState#