JobStartedEvent
EventType: JOB_STARTEDDomain: production Broker subject: progress.notification.production
Transitions a job from CREATED to STARTED state, creates the first Batch and a WorkSession record as child events, assigns the operator to the job, and optionally adds the job to the operator's queue when the job was previously unassigned.
Sequence Diagram
Trigger
Triggered by: POST /event (universal event dispatcher)
Dispatched via POST /event in backend/api/endpoints/traceability.py with event_type: JOB_STARTED. The production webapp sends this when the operator presses Start Job on the job assignment list.
Preconditions
- Job exists with key
info.job_key - Job
stageisCREATED(raisesJobIsStartedErrorotherwise) - If
config.show_unassigned_jobs_to_operatorsisfalse, job must have anassigned_tovalue (raisesJobHasNoAssigneeErrorotherwise)
State Changes (Transaction)
Collections: Inherited from BaseProductionEvent.get_tx_collections() — Batch, batch_serial, Event, Job, Queue, Serial, StepExecutionData, wip, WorkOrder, WorkSession, contains, Config, Counter, is_in_position, Position, movement, Issue, issue_rel
Jobupdated:stage → STARTED,start,active → true,assigned_to,active_batch_key,active_batch_qt,last_online,last_work_session_startedBatchinserted viaBatchCreatedEvent.create_as_child()WorkSessioninserted viaWorkSessionCreatedEvent.create_as_child()Queueupdated if job was unassigned andcan_self_assignis true
Side Effects (post_processing)
Inherits post_processing() from BaseProductionEvent:
- Updates
job.last_onlinetimestamp - Recalculates work order status via
update_work_order(); spawnsWorkOrderStartedEventas child if work order transitions toSTARTED - Publishes to
progress.notification.production
InfoModel Fields
| Field | Type | Description |
|---|---|---|
job_key | str | ArangoDB key of the job to start |
batch_serials | list[str] | None | Serial keys to associate with the first batch |
work_order_key | str | None | Work order key (carried through to child events) |
phase_key | str | None | Phase key for the job's current phase |
Related Events
BatchCreatedEvent— spawned as child to create the first active batchWorkSessionCreatedEvent— spawned as child to open the operator's session