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. More...
 
 ~Broker ()
 Destructor. BrokerPlugin unloading is handled automatically. More...
 
Brokeroperator= (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 JobDescriptiongetJobDescription () 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...
 

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

◆ Broker() [1/3]

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.

◆ Broker() [2/3]

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.

◆ Broker() [3/3]

Arc::Broker::Broker ( const Broker b)

Copy constructor. BrokerPlugin copying is handled automatically.

◆ ~Broker()

Arc::Broker::~Broker ( )

Destructor. BrokerPlugin unloading is handled automatically.

Member Function Documentation

◆ genericMatch()

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.

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:

  1. Credential object is not part of JobDescription object, but is obtained from the passed UserConfig object.
  2. Check is only made if TrustedCA list is not empty.
  3. If MaxTotalCPUTime is not set, the next check in the table is made.
  4. Check is only done if MaxTotalCPUTime is not set.
  5. If MainMemorySize is not set, the next check in the table is made.
  6. Check is only done if MainMemorySize is not set.
  7. Check doesn't fail if MaxDiskSpace or MaxMainMemory respectively is not set. Both attributes must be unspecified, and SessionDiskSpace be specified before the checks fails.
  8. Check doesn't fail if MaxDiskSpace or MaxMainMemory respectively is not set. Both attributes must be unspecified, and DiskSpace be specified before the checks fails.
  9. Check doesn't fail if TotalSlots or MaxSlotsPerJob respectively is not set. Both attributes must be unspecified, and NumberOfSlots be specified before the checks fails.
Returns
True if target matches job description.

◆ getJobDescription()

const JobDescription& Arc::Broker::getJobDescription ( ) const
inline

Get the JobDescription set by set().

◆ isValid()

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.

◆ match()

bool Arc::Broker::match ( const ExecutionTarget et) const

Returns true if the ExecutionTarget is allowed by BrokerPlugin.

◆ operator()()

bool Arc::Broker::operator() ( const ExecutionTarget lhs,
const ExecutionTarget rhs 
) const

Used to sort targets. Returns true if lhs<rhs according to BrokerPlugin.

◆ operator=()

Broker& Arc::Broker::operator= ( const Broker b)

Assignment operator. BrokerPlugin copying is handled automatically.

Python interface deviation
Method is unavailable in Python interface

◆ set()

void Arc::Broker::set ( const JobDescription _j) const

Set the JobDescription to use during brokering.


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