qcg.pilotjob.publisher module¶
-
class
qcg.pilotjob.publisher.
EventTopic
¶ Bases:
enum.Enum
Published event types.
-
ITERATION_STATUS
= 'IST'¶
-
ITERATION_FINISHED
= 'IFI'¶
-
JOB_STATUS
= 'JST'¶
-
JOB_FINISHED
= 'JFI'¶
-
NO_JOBS
= 'NOJ'¶
-
-
class
qcg.pilotjob.publisher.
StatusPublisher
¶ Bases:
object
Publish job status change notifications.
Publisher handles notifications with queing events to publish. The queing event is done synchronously. In the background the sender task takes queued events and sent them (asynchronously).
-
zmq_ctx
¶ ZMQ context
Type: Context
-
socket
¶ ZMQ PUB socket
Type: socket
-
address
¶ address of ZMQ PUB interface from configuration
Type: str
-
local_port
¶ listen port number
Type: int
-
external_address
¶ address on external network interface (not on private ips)
Type: str
Initialize Publisher.
-
setup
(conf)¶ Create Publisher interface.
If port number is not specified in QCG-PilotJob configuration, it is chosen randomly from configured range.
-
static
encode_published_data
(topic, data)¶ Encode event data to be sent with send_string socket method.
Parameters: - (EventTopic) (topic) – the event topic
- (obj) (data) – data to sent
Returns: encoded event with topic as string
-
static
decode_published_data
(event_message)¶ Decode received event.
Parameters: event_message – the received message Returns: tupple (EventTopic, object) with event topic and deserialized data Raise: UnknownEventTopic - when received topic is not known WrongEventFormat - when event data cannot be deserialized
-
publish
(topic, data)¶ Publish event
Parameters: - (EventTopic) (topic) – event’s topic
- (obj) (data) – event data
-
stop
()¶ Cleanup.
-