ARC SDK
Public Member Functions | Static Public Member Functions
Arc::Broker Class Reference

A Broker filters and ranks acceptable targets for job submission. More...

#include <arc/compute/Broker.h>

Public Member Functions

 Broker (const UserConfig &uc, const std::string &name="")
 Construct a new broker and load the BrokerPlugin of the given type. More...
 
 Broker (const UserConfig &uc, const JobDescription &j, const std::string &name="")
 Construct a new broker of the given type and use the given JobDescription. More...
 
 Broker (const Broker &b)
 Copy constructor. BrokerPlugin copying is handled automatically.
 
 ~Broker ()
 Destructor. BrokerPlugin unloading is handled automatically.
 
Brokeroperator= (const Broker &b)
 Assignment operator. BrokerPlugin copying is handled automatically.
 
bool operator() (const ExecutionTarget &lhs, const ExecutionTarget &rhs) const
 Used to sort targets. Returns true if lhs<rhs according to BrokerPlugin.
 
bool match (const ExecutionTarget &et) const
 Returns true if the ExecutionTarget is allowed by BrokerPlugin.
 
bool isValid (bool alsoCheckJobDescription=true) const
 Returns true if the BrokerPlugin loaded by this Broker is valid. More...
 
void set (const JobDescription &_j) const
 Set the JobDescription to use during brokering.
 
const JobDescriptiongetJobDescription () const
 Get the JobDescription set by set().
 

Static Public Member Functions

static bool genericMatch (const ExecutionTarget &et, const JobDescription &j, const Arc::UserConfig &)
 Perform a match between the given target and job. More...
 

Detailed Description

A Broker filters and ranks acceptable targets for job submission.

This class is the high-level interface to brokers. It takes care of loading at runtime the specific BrokerPlugin type which matches and ranks ExecutionTargets according to specific criteria, for example queue length or CPU benchmark. The type of BrokerPlugin to use is specified in the constructor.

The usual workflow is to call set() for the Broker to obtain the parameters or constraints from the job that it is interested in, then match() for each ExecutionTarget to filter targets. operator() can then be used to sort the targets and is equivalent to ExecutionTarget.operator<(ExecutionTarget).

ExecutionTargetSorter can be used as a wrapper around Broker to avoid calling Broker directly.

Constructor & Destructor Documentation

Arc::Broker::Broker ( const UserConfig uc,
const std::string &  name = "" 
)

Construct a new broker and load the BrokerPlugin of the given type.

Parameters
ucUserConfig, passed to the BrokerPlugin.
nameName of the BrokerPlugin type to use. If empty then targets are matched using genericMatch() but are not sorted.
Arc::Broker::Broker ( const UserConfig uc,
const JobDescription j,
const std::string &  name = "" 
)

Construct a new broker of the given type and use the given JobDescription.

Parameters
ucUserConfig, passed to the BrokerPlugin.
jset(j) is called from this constructor.
nameName of the BrokerPlugin type to use. If empty then targets are matched using genericMatch() but are not sorted.

Member Function Documentation

static bool Arc::Broker::genericMatch ( const ExecutionTarget et,
const JobDescription j,
const Arc::UserConfig  
)
static

Perform a match between the given target and job.

This method is generally called by BrokerPlugins at the start of match() to check that a target matches general attributes of the job such as CPU and memory limits. The BrokerPlugin then does further matching depending on its own criteria.

Returns
True if target matches job description.
bool Arc::Broker::isValid ( bool  alsoCheckJobDescription = true) const

Returns true if the BrokerPlugin loaded by this Broker is valid.

Parameters
alsoCheckJobDescriptionAlso check if JobDescription is valid.

The documentation for this class was generated from the following file: