qcg.pilotjob.receiver module
- class qcg.pilotjob.receiver.ResponseStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
EnumRequest response status.
- UNKNOWN = 1
- ERROR = 2
- SUCCESS = 3
- class qcg.pilotjob.receiver.ValidateResponse
Bases:
objectThe response data.
- result
status
- Type
- msg
response message
- Type
str
Initialize response.
- error(err_msg)
Set response as an error.
- Parameters
err_msg (str) – response error message
- property is_error
is an error response
- Type
bool
- property is_success
is a success response
- Type
bool
- class qcg.pilotjob.receiver.Receiver(handler, ifaces)
Bases:
objectThe receiver listens for requests on input interfaces and passes requests to handlers (managers).
- _ifaces
list of interfaces to listen for requests
- Type
list(Interface)
- _tasks
list of tasks that listens on interfaces for incoming requests
- Type
list(asyncio.Future)
- _zmq_address
address of the ZMQ input interface
- Type
str
- _handlers
map of requests and handler functions
- Type
dict
- finished
flag set by the handlers when receiving should be finished
- Type
bool
Initialize receiver.
- Parameters
handler – manager that handles requests
ifaces (Interface[]) – list of interfaces
- property zmq_address
address of ZMQ interface
- Type
str
- property interfaces
list of input interfaces
- Type
list(Interface)
- set_finish(finished)
Set finish flag.
If set to True the receiver should not accept any new requests and whole service should finish. The service will monitor this flag to know when receiver finished accepting requests.
- Parameters
finished (bool) – the finish flag
- property is_finished
the value of finish flag
- Type
bool
- run()
Start listening on interfaces.
This method creates asynchronic tasks and returns. To stop created tasks, method ‘stop’ must be called.
- async stop()
Stop all listening on interfaces.
- async cancel_listeners()
Cancel all interface listeners.