ARC SDK
|
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. More... | |
~Broker () | |
Destructor. BrokerPlugin unloading is handled automatically. More... | |
Broker & | operator= (const Broker &b) |
Assignment operator. BrokerPlugin copying is handled automatically. More... | |
bool | operator() (const ExecutionTarget &lhs, const ExecutionTarget &rhs) const |
Used to sort targets. Returns true if lhs<rhs according to BrokerPlugin. More... | |
bool | match (const ExecutionTarget &et) const |
Returns true if the ExecutionTarget is allowed by BrokerPlugin. More... | |
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. More... | |
const JobDescription & | getJobDescription () const |
Get the JobDescription set by set(). More... | |
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... | |
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.
Arc::Broker::Broker | ( | const UserConfig & | uc, |
const std::string & | name = "" |
||
) |
Construct a new broker and load the BrokerPlugin of the given type.
uc | UserConfig, passed to the BrokerPlugin. |
name | Name 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.
uc | UserConfig, passed to the BrokerPlugin. |
j | set(j) is called from this constructor. |
name | Name of the BrokerPlugin type to use. If empty then targets are matched using genericMatch() but are not sorted. |
Arc::Broker::Broker | ( | const Broker & | b | ) |
Copy constructor. BrokerPlugin copying is handled automatically.
Arc::Broker::~Broker | ( | ) |
Destructor. BrokerPlugin unloading is handled automatically.
|
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.
The table below list all the checks in order made by this method. If a check fails the method returns false. Generally a check is only made if the attribute in the left column are set in the JobDescription object. Contrary if a resource attribute in the right column is not set, and the corresponding JobDescription attribute is set, then generally the check will fail and the method returns false. If all relevant checks succeeds this method returns true.
JobDescription attribute | Comparator | ExecutionTarget attribute |
---|---|---|
CA DN of Credentials [1] | in | TrustedCA [2] |
OtherAttributes["nordugrid:broker;reject_queue"] | != | ComputingShare.Name |
QueueName | == | ComputingShare.Name |
ProcessingStartTime | < | DowntimeStarts |
ProcessingStartTime | > | DowntimeEnds |
— | lower(HealthState) == "ok" | |
CEType | isSatisfied | Implementation |
IndividualWallTime.max | <= | MaxWallTime |
IndividualWallTime.min | >= | MinWallTime |
IndividualCPUTime.max | <= | MaxCPUTime |
IndividualCPUTime.min | >= | MinCPUTime |
TotalCPUTime | <= | MaxTotalCPUTime [3] |
TotalCPUTime / NumberOfSlots | <= | MaxCPUTime [4] |
TotalCPUTime / NumberOfSlots | >= | MinCPUTime |
IndividualPhysicalMemory | <= | MainMemorySize [5] |
IndividualPhysicalMemory | <= | MaxMainMemory [6] |
IndividualVirtualMemory | <= | MaxVirtualMemory |
Platform | == | Platform |
OperatingSystem | isSatisfied | OperatingSystem |
RunTimeEnvironment | isSatisfied | ApplicationEnvironment |
NetworkInfo | in | NetworkInfo |
SessionDiskSpace | <= | 1024*MaxDiskSpace [7] |
SessionDiskSpace | <= | 1024*WorkingAreaFree [7] |
DiskSpace | <= | 1024*MaxDiskSpace [8] |
DiskSpace | <= | 1024*WorkingAreaFree [8] |
CacheDiskSpace | <= | 1024*CacheTotal |
NumberOfSlots | <= | TotalSlots [9] |
NumberOfSlots | <= | MaxSlotsPerJob [9] |
SessionLifeTime | <= | WorkingAreaLifeTime |
NodeAccess is NAT_INBOUND OR NAT_INOUTBOUND | AND | ConnectivityIn is true |
NodeAccess is NAT_OUTBOUND OR NAT_INOUTBOUND | AND | ConnectivityOut is true |
Notes:
|
inline |
Get the JobDescription set by set().
bool Arc::Broker::isValid | ( | bool | alsoCheckJobDescription = true | ) | const |
Returns true if the BrokerPlugin loaded by this Broker is valid.
alsoCheckJobDescription | Also check if JobDescription is valid. |
bool Arc::Broker::match | ( | const ExecutionTarget & | et | ) | const |
Returns true if the ExecutionTarget is allowed by BrokerPlugin.
bool Arc::Broker::operator() | ( | const ExecutionTarget & | lhs, |
const ExecutionTarget & | rhs | ||
) | const |
Used to sort targets. Returns true if lhs<rhs according to BrokerPlugin.
Assignment operator. BrokerPlugin copying is handled automatically.
void Arc::Broker::set | ( | const JobDescription & | _j | ) | const |
Set the JobDescription to use during brokering.