Requester object that takes jobs and returns results. Communicates with a delegator living in a (possibly) different thread.
More...
#include <requester.hpp>
|
| Requester (Delegator &d) |
| Create a new Requester. More...
|
|
ResultData | operator() (const JobData &j) |
| Computes a job and returns a result. More...
|
|
void | submit (uint id, const JobData &j) |
| Submits a job for computation and immediately returns. An id is included to allow the job to be identified later, because when jobs are retrieved they may not arrive in the order they were submitted. More...
|
|
std::pair< uint, ResultData > | retrieve () |
| Retrieves a job that has previously been submitted for computation. A pair is returned, with the id of the job (from the submit call), and the result. Note that jobs may not be retrieved in the order they were submitted. More...
|
|
std::vector< ResultData > | batch (const std::vector< JobData > &jobs) |
| Computes a batch of jobs and returns a result. The function returns when all results have been returned. More...
|
|
void | batchSubmit (uint id, const std::vector< JobData > &jobs) |
| Submits a batch of jobs for computation and immediately returns. An id is included to allow the batch to be identified later, because when batches are retrieved they may not arrive in the order they were submitted. More...
|
|
std::pair< uint, std::vector
< ResultData > > | batchRetrieve () |
| Retrieves a batch of jobs that have previously been submitted for computation. A pair is returned, with the id of the batch (from the submit call), and the results. Note that batch may not be retrieved in the order they were submitted. More...
|
|
Requester object that takes jobs and returns results. Communicates with a delegator living in a (possibly) different thread.
- Template Parameters
-
JobType | The type of a job specification. |
ResultType | The type being return as a result. / |
stateline::comms::Requester::Requester |
( |
Delegator & |
d | ) |
|
Create a new Requester.
- Parameters
-
d | A reference to the delegator object to communicate with |
std::vector< ResultData > stateline::comms::Requester::batch |
( |
const std::vector< JobData > & |
jobs | ) |
|
Computes a batch of jobs and returns a result. The function returns when all results have been returned.
- Warning
- Do not interleave different types of job call pairs and blocking calls. This will break horribly. For example, don't call submit in between batchsubmit and batch retrieve.
- Parameters
-
jobs | The vector of jobs to compute |
- Returns
- The results of the job computations
std::pair< uint, std::vector< ResultData > > stateline::comms::Requester::batchRetrieve |
( |
| ) |
|
Retrieves a batch of jobs that have previously been submitted for computation. A pair is returned, with the id of the batch (from the submit call), and the results. Note that batch may not be retrieved in the order they were submitted.
- Warning
- Do not interleave different types of job call pairs and blocking calls. This will break horribly. For example, don't call submit in between batchsubmit and batch retrieve.
- Returns
- A pair of the job id and the result
void stateline::comms::Requester::batchSubmit |
( |
uint |
id, |
|
|
const std::vector< JobData > & |
jobs |
|
) |
| |
Submits a batch of jobs for computation and immediately returns. An id is included to allow the batch to be identified later, because when batches are retrieved they may not arrive in the order they were submitted.
- Warning
- Do not interleave different types of job call pairs and blocking calls. This will break horribly. For example, don't call submit in between batchsubmit and batch retrieve.
- Parameters
-
id | The id of the batch |
jobs | The vector of jobs to compute |
- Returns
- The results of the job computations
Computes a job and returns a result.
- Warning
- Do not interleave different types of job call pairs and blocking calls. This will break horribly. For example, don't call submit in between batchsubmit and batch retrieve.
- Parameters
-
- Returns
- The result of the job computation.
std::pair< uint, ResultData > stateline::comms::Requester::retrieve |
( |
| ) |
|
Retrieves a job that has previously been submitted for computation. A pair is returned, with the id of the job (from the submit call), and the result. Note that jobs may not be retrieved in the order they were submitted.
- Warning
- Do not interleave different types of job call pairs and blocking calls. This will break horribly. For example, don't call submit in between batchsubmit and batch retrieve.
- Returns
- A pair of the job id and the result
void stateline::comms::Requester::submit |
( |
uint |
id, |
|
|
const JobData & |
j |
|
) |
| |
Submits a job for computation and immediately returns. An id is included to allow the job to be identified later, because when jobs are retrieved they may not arrive in the order they were submitted.
- Warning
- Do not interleave different types of job call pairs and blocking calls. This will break horribly. For example, don't call submit in between batchsubmit and batch retrieve.
- Parameters
-
id | The job ID. |
j | The job to compute. |
The documentation for this class was generated from the following files: