Skip to content

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 stage is CREATED (raises JobIsStartedError otherwise)
  • If config.show_unassigned_jobs_to_operators is false, job must have an assigned_to value (raises JobHasNoAssigneeError otherwise)

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

  • Job updated: stage → STARTED, start, active → true, assigned_to, active_batch_key, active_batch_qt, last_online, last_work_session_started
  • Batch inserted via BatchCreatedEvent.create_as_child()
  • WorkSession inserted via WorkSessionCreatedEvent.create_as_child()
  • Queue updated if job was unassigned and can_self_assign is true

Side Effects (post_processing) ​

Inherits post_processing() from BaseProductionEvent:

  • Updates job.last_online timestamp
  • Recalculates work order status via update_work_order(); spawns WorkOrderStartedEvent as child if work order transitions to STARTED
  • Publishes to progress.notification.production

InfoModel Fields ​

FieldTypeDescription
job_keystrArangoDB key of the job to start
batch_serialslist[str] | NoneSerial keys to associate with the first batch
work_order_keystr | NoneWork order key (carried through to child events)
phase_keystr | NonePhase key for the job's current phase

Source ​

JobStartedEvent on GitHub

Released under the Apache 2.0 License.