kafka_dae_control.worker_event_handlers
Handlers called by the worker thread.
Members
Act on a Kafka delivery report. |
|
Handle a begin command. |
|
Handle an end command. |
|
Handle a frame sync select setpoint change. |
|
Handle a pause or resume. |
|
Handle a run control update. |
|
Handle a veto configuration change. |
|
Set the current period number on the hardware. |
|
Set the number of periods on the hardware. |
|
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