profit.run.zeromq
zeromq Interface
Ideas & Help from the 0MQ Guide (zguide.zeromq.org, examples are licensed with MIT)
Module Contents
Classes
Runner-Worker Interface using the lightweight message queue ZeroMQ |
|
Runner-Worker Interface using the lightweight message queue ZeroMQ |
- class profit.run.zeromq.ZeroMQRunnerInterface(size, input_config, output_config, *, transport='tcp', address=None, port=9000, connection=None, bind=None, timeout=4, retries=3, retry_sleep=1, logger_parent: logging.Logger = None)[source]
Bases:
profit.run.interface.RunnerInterface
Runner-Worker Interface using the lightweight message queue ZeroMQ
can use different transport systems, most commonly tcp
can be used efficiently on a cluster (tested)
expected to be inefficient for a large number of small, locally run simulations where communication overhead is a concern (unverified, could be mitigated by using a different transport system)
known issue: some workers were unable to establish a connection with three tries, reason unknown
- Parameters:
transport – ZeroMQ transport protocol
address – override ip address or hostname of the Runner Interface (default: localhost, automatic with Slurm)
port – port of the Runner Interface
connection – override for the ZeroMQ connection spec (Worker side)
bind – override for the ZeroMQ bind spec (Runner side)
timeout – connection timeout when waiting for an answer in seconds (Worker)
retries – number of tries to establish a connection (Worker)
retry_sleep – sleep time in seconds between each retry (Worker)
- socket
ZeroMQ backend
- Type:
zmq.Socket
- logger
Logger
- Type:
logging.Logger
- property bind
- property config
- class profit.run.zeromq.ZeroMQWorkerInterface(run_id: int, *, transport='tcp', address=None, port=9000, connection=None, bind=None, timeout=4, retries=3, retry_sleep=1, logger_parent: logging.Logger = None)[source]
Bases:
profit.run.interface.WorkerInterface
Runner-Worker Interface using the lightweight message queue ZeroMQ
counterpart to
ZeroMQRunnerInterface
- property connection
- property config
- retrieve()[source]
retrieve the input
connect to the Runner-Interface
retrieve the input data and store it in .input