DataSender Module#
SPDX-FileCopyrightText: 2024 DESY and the Constellation authors SPDX-License-Identifier: EUPL-1.2
A base module for a Constellation Satellite that sends data.
- class core.datasender.DataSender(*args: Any, data_port: int, **kwargs: Any)#
Bases:
Satellite
Constellation Satellite which pushes data via ZMQ.
You can modify the timeouts for packets sent via ZMQ depending on the type of packet: - bor_timeout (int) : timeout for beginning-of-run packets (in milliseconds). - data_timeout (int) : timeout for data packets (in milliseconds). - eor_timeout (int) : timeout for end-of-run packets (in milliseconds).
A value of -1 is interpreted as infinite.
- do_run(run_identifier: str) str #
Perform the data acquisition and enqueue the results.
This is only an abstract method. Inheriting classes must implement their own acquisition method.
This method will be executed in a separate thread by the underlying Satellite class. It therefore needs to monitor the self.stop_running Event and close itself down if the Event is set.
If you want to transmit a payload as part of the end-of-run event (BOR), set the corresponding value via the BOR property before leaving this method.
This method should return a string that will be used for setting the Status once the data acquisition is finished.
- class core.datasender.DataSenderArgumentParser(*args: Any, **kwargs: Any)#
Bases:
SatelliteArgumentParser
Customized Argument parser providing DataSender-specific options.
- class core.datasender.PushThread(name: str, stopevt: Event, borevt: Event, eorevt: Event, socket: Socket, timeouts: list[int], queue: Queue, *args: Any, **kwargs: Any)#
Bases:
Thread
Thread that pushes CDTPMessages from a Queue to a ZMQ socket.
- join(*args: Any, **kwargs: Any) Any #
Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a floating-point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.
When the timeout argument is not present or None, the operation will block until the thread terminates.
A thread can be join()ed many times.
join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.
- class core.datasender.RandomDataSender(*args: Any, data_port: int, **kwargs: Any)#
Bases:
DataSender
Constellation Satellite which pushes RANDOM data via ZMQ.