kafka_dae_control.worker_event_handlers

Handlers called by the worker thread.

Members

delivery_report_set_error_or_done

Act on a Kafka delivery report.

handle_begin

Handle a begin command.

handle_end

Handle an end command.

handle_frame_sync_sp_change

Handle a frame sync select setpoint change.

handle_pause_or_resume

Handle a pause or resume.

handle_run_control_update

Handle a run control update.

handle_vetoes_change

Handle a veto configuration change.

set_current_period

Set the current period number on the hardware.

set_num_periods

Set the number of periods on the hardware.

set_period_mode

Set the period mode on the hardware.

kafka_dae_control.worker_event_handlers.delivery_report_set_error_or_done(done_event: EventWithError, err: KafkaError | None, msg: Message) None[source]

Act on a Kafka delivery report.

This is used for the run info messages to tell anything waiting on these that the message was either delivered or not.

Parameters:
  • done_event – The event to call set() or set exception depending on result.

  • err – The exception given by Kafka

  • msg – The message sent by Kafka.

kafka_dae_control.worker_event_handlers.handle_begin(config: ControlConfig, data: Data, producer: Producer, sock: socket, sock_lock: RLock, done_event: EventWithError, queue: PriorityQueue[QueueItem]) None[source]

Handle a begin command.

Parameters:
  • config – the program’s configuration.

  • data – the data class containing the state of the program.

  • producer – the Kafka producer.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

  • queue – The queue to put hardware polling updates on after beginning

kafka_dae_control.worker_event_handlers.handle_end(config: ControlConfig, data: Data, producer: Producer, sock: socket, sock_lock: RLock, done_event: EventWithError, queue: PriorityQueue[QueueItem]) None[source]

Handle an end command.

Parameters:
  • config – The program’s configuration.

  • data – the data class containing the state of the program.

  • producer – the Kafka producer.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

  • queue – The queue to put hardware polling updates on after ending

kafka_dae_control.worker_event_handlers.handle_frame_sync_sp_change(value: FrameSyncSelect, config: ControlConfig, data: Data, sock: socket, sock_lock: RLock, done_event: EventWithError) None[source]

Handle a frame sync select setpoint change.

Parameters:
  • value – the new value to write to hardware

  • config – The program’s configuration.

  • data – the data class containing the state of the program.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

kafka_dae_control.worker_event_handlers.handle_pause_or_resume(value: bool, config: ControlConfig, data: Data, sock: socket, sock_lock: RLock, done_event: EventWithError) None[source]

Handle a pause or resume.

Parameters:
  • value – The bit mask list of vetoes to set.

  • config – The program’s configuration.

  • data – the program’s data class.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

kafka_dae_control.worker_event_handlers.handle_run_control_update(value: bool, config: ControlConfig, sock: socket, sock_lock: RLock) None[source]

Handle a run control update.

Parameters:
  • value – The bit mask list of vetoes to set.

  • config – The program’s configuration.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

kafka_dae_control.worker_event_handlers.handle_vetoes_change(value: NDArray[uint8], config: ControlConfig, data: Data, producer: Producer, sock: socket, sock_lock: RLock, done_event: EventWithError) None[source]

Handle a veto configuration change.

This sets the hard vetoes on the hardware, then sends a vc00 update with hard and soft vetoes.

Parameters:
  • value – The bit mask list of vetoes to set.

  • config – The program’s configuration.

  • data – the data class containing the state of the program.

  • producer – the Kafka producer.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

kafka_dae_control.worker_event_handlers.set_current_period(value: int, config: ControlConfig, data: Data, sock: socket, sock_lock: RLock, done_event: EventWithError) None[source]

Set the current period number on the hardware.

Parameters:
  • value – the new value to write to hardware

  • config – The program’s configuration.

  • data – the data class containing the state of the program.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

kafka_dae_control.worker_event_handlers.set_num_periods(value: int, config: ControlConfig, data: Data, sock: socket, sock_lock: RLock, done_event: EventWithError) None[source]

Set the number of periods on the hardware.

Parameters:
  • value – the new value to write to hardware

  • config – The program’s configuration.

  • data – the data class containing the state of the program.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete

kafka_dae_control.worker_event_handlers.set_period_mode(value: PeriodMode, config: ControlConfig, data: Data, sock: socket, sock_lock: RLock, done_event: EventWithError) None[source]

Set the period mode on the hardware.

Parameters:
  • value – the new value to write to hardware

  • config – The program’s configuration.

  • data – the data class containing the state of the program.

  • sock – the socket instance.

  • sock_lock – the lock to acquire when using the socket instance.

  • done_event – The event to call set() on when complete