Subscribers¶
Base Subscribers¶
-
class
ssdaq.core.AsyncWriterSubscriber(file_prefix: str, ip: str, port: int, subscriber: ssdaq.core.basesubscribers.AsyncSubscriber, writer, file_ext: str, name: str, folder: str = '', file_enumerator: str = None, filesize_lim: int = None, loop=None)¶ A data file writer for slow signal data.
This class uses a instance of a SSReadoutSubscriber to receive readouts and an instance of SSDataWriter to write an HDF5 file to disk.
-
close(hard: bool = False)¶ Stops the writer by closing the subscriber.
Parameters: hard (bool, optional) – If set to true the subscriber buffer will be dropped and the file will be immediately closed. Any data still in the subscriber buffer will be lost.
-
-
class
ssdaq.core.AsyncSubscriber(ip: str, port: int, unpack=None, logger: logging.Logger = None, zmqcontext=None, loop=None, passoff_callback=None, name: str = None)¶ -
close(hard=True)¶ Closes subscriber so no more data is put in the buffer
Parameters: hard (bool) – If set to true the buffer will be emptied and any data still in the buffer will be lost.
-
empty()¶ Returns true if the subscriber buffer is empty
-
get_data()¶ Get data from the subscriber buffer.
Returns: data object Return type: data
-
-
class
ssdaq.core.WriterSubscriber(file_prefix: str, ip: str, port: int, subscriber: ssdaq.core.basesubscribers.BasicSubscriber, writer, file_ext: str, name: str, folder: str = '', file_enumerator: str = None, filesize_lim: int = None)¶ -
close(hard: bool = False, non_block: bool = False)¶ Stops the writer by closing the subscriber
Parameters: - hard (bool) – If set to true the subscriber buffer will be dropped and the file will be immediately closed. Any data still in the subscriber buffer will be lost.
- non_block (bool) – If set to true will not block
-
run()¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
-
-
class
ssdaq.core.BasicSubscriber(ip: str, port: int, unpack=None, logger: logging.Logger = None)¶ The base class to subscribe to a published data stream from a reciver. Data are retrived by the get_data() method once the listener has been started by the start() method
-
close(hard=True)¶ Closes subscriber so no more data is put in the buffer :param hard: If set to true the buffer will be emptied and
any data still in the buffer will be lost.
-
empty()¶ Returns true if the subscriber buffer is empty
-
get_data(**kwargs)¶ Returns unpacked data from the published data stream. By default a blocking call. See python Queue docs.
- Kwargs:
- See queue.Queue docs
-
run()¶ This is the main method of the listener
-