Requester object that takes jobs and returns results. Communicates with a delegator living in a (possibly) different thread.
More...
#include <delegator.hpp>
|
| | Delegator (const std::string &commonSpecData, const std::vector< uint > &jobId, const std::vector< std::string > &jobSpecData, const std::vector< std::string > &jobResultsData, const DelegatorSettings &settings) |
| | Create a new delegator. More...
|
| |
|
| ~Delegator () |
| | Safely stops all polling threads and cleans up.
|
| |
| zmq::context_t & | zmqContext () |
| | Return a reference to the context object owned by the delegator. this allows a requester to use inproc sockets and connect. More...
|
| |
|
void | start () |
| | Start the delegator socket polling.
|
| |
|
void | stop () |
| | Stop the delegator socket polling.
|
| |
| void | sendWorkerProblemSpec (const Message &m) |
| | Initialise a worker by giving it the problem specification. More...
|
| |
| void | connectWorker (const Message &m) |
| | Connect a worker that has previously been sent a problem spec. More...
|
| |
| void | sendJob (const Message &m) |
| | Send a job to a worker that has requested one. More...
|
| |
| void | disconnectWorker (const Message &m) |
| | Disconnect a worker by removing it from the list of connected workers. More...
|
| |
| void | sendFailed (const Message &m) |
| | When a send fails, we disconnect the worker. More...
|
| |
| void | jobRequest (const Message &m) |
| | Process a job request by sending a job to the worker if available, otherwise add to a needs job queue. More...
|
| |
| void | jobSwap (const Message &m) |
| | Get a result from a worker, then swap it for a new job. More...
|
| |
| void | newJob (const Message &m) |
| | Receive a new job from the requesters, and add it to the queue or send it directly to an idle worker. More...
|
| |
Requester object that takes jobs and returns results. Communicates with a delegator living in a (possibly) different thread.
| stateline::comms::Delegator::Delegator |
( |
const std::string & |
commonSpecData, |
|
|
const std::vector< uint > & |
jobId, |
|
|
const std::vector< std::string > & |
jobSpecData, |
|
|
const std::vector< std::string > & |
jobResultsData, |
|
|
const DelegatorSettings & |
settings |
|
) |
| |
Create a new delegator.
- Parameters
-
| commonSpecData | The serialised common problem specification. |
| jobId | The available job IDs. |
| jobSpecData | The serialised problem specifications for each job. |
| jobResultsData | The serialised problem results for each job. |
| settings | The configuration object. |
| void stateline::comms::Delegator::connectWorker |
( |
const Message & |
m | ) |
|
Connect a worker that has previously been sent a problem spec.
- Parameters
-
| m | The JOBREQUEST message the connecting worker sent. |
| void stateline::comms::Delegator::disconnectWorker |
( |
const Message & |
m | ) |
|
Disconnect a worker by removing it from the list of connected workers.
- Parameters
-
| m | The GOODBYE message the connecting worker sent. |
| void stateline::comms::Delegator::jobRequest |
( |
const Message & |
m | ) |
|
Process a job request by sending a job to the worker if available, otherwise add to a needs job queue.
- Parameters
-
| void stateline::comms::Delegator::jobSwap |
( |
const Message & |
m | ) |
|
Get a result from a worker, then swap it for a new job.
- Parameters
-
| void stateline::comms::Delegator::newJob |
( |
const Message & |
m | ) |
|
Receive a new job from the requesters, and add it to the queue or send it directly to an idle worker.
- Parameters
-
| void stateline::comms::Delegator::sendFailed |
( |
const Message & |
m | ) |
|
When a send fails, we disconnect the worker.
- Parameters
-
| m | The message that failed to send. |
| void stateline::comms::Delegator::sendJob |
( |
const Message & |
m | ) |
|
Send a job to a worker that has requested one.
- Parameters
-
| m | the job request message. |
| void stateline::comms::Delegator::sendWorkerProblemSpec |
( |
const Message & |
m | ) |
|
Initialise a worker by giving it the problem specification.
- Parameters
-
| m | The HELLO message the new worker sent. |
| zmq::context_t& stateline::comms::Delegator::zmqContext |
( |
| ) |
|
|
inline |
Return a reference to the context object owned by the delegator. this allows a requester to use inproc sockets and connect.
- Returns
- a reference to the zmq::context_t object
The documentation for this class was generated from the following files: