Obsidian
Probabilistic Geophysical Joint Inversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
stateline::comms::Worker Class Reference

Worker object that takes jobs, forwards them to a minion then receives results from the minion and send them back to the delegator. More...

#include <worker.hpp>

Public Member Functions

 Worker (const std::vector< uint > &jobIDs, const WorkerSettings &settings)
 Build a new worker. More...
 
 ~Worker ()
 Destructor. Safely stops all polling threads and cleans up.
 
void stop ()
 Stop the worker polling sockets.
 
zmq::context_t & zmqContext ()
 Return a ref to the context object owned by the worker. This allows a minion to use inproc sockets and connect. More...
 
const std::string & globalSpec ()
 Return a reference to the problemspec so that the minions can instantiate their sockets. More...
 
const std::string & jobSpec (uint jobID)
 Return the individual job specifications for the minions. More...
 
const std::set< uint > jobsEnabled () const
 Return a set of job IDs that are enabled. More...
 
const std::string & jobResults (uint jobID)
 Return the result of a particular job. More...
 

Detailed Description

Worker object that takes jobs, forwards them to a minion then receives results from the minion and send them back to the delegator.

Constructor & Destructor Documentation

stateline::comms::Worker::Worker ( const std::vector< uint > &  jobIDs,
const WorkerSettings settings 
)

Build a new worker.

Parameters
jobIDsA list of job IDs that the worker can do.
settingsThe configuration object.

Member Function Documentation

const std::string& stateline::comms::Worker::globalSpec ( )
inline

Return a reference to the problemspec so that the minions can instantiate their sockets.

Returns
A reference to the worker-owned problemspec.
const std::string& stateline::comms::Worker::jobResults ( uint  jobID)
inline

Return the result of a particular job.

Parameters
jobIDThe ID of the job.
Returns
A const reference to the serialised result of a job.
const std::set<uint> stateline::comms::Worker::jobsEnabled ( ) const
inline

Return a set of job IDs that are enabled.

Returns
Set of jobs IDs that are enabled.
const std::string& stateline::comms::Worker::jobSpec ( uint  jobID)
inline

Return the individual job specifications for the minions.

Returns
A reference to the worker-owned jobspec.
zmq::context_t& stateline::comms::Worker::zmqContext ( )
inline

Return a ref to the context object owned by the worker. This allows a minion 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: