Provides a representation of the job description in the JDL language and the functions for building and manipulating it. More...
#include <src/requestad/JobAd.h>
Public Member Functions | ||||||||||||||||
Constructors/Destructor | ||||||||||||||||
JobAd () | ||||||||||||||||
Instantiates an empty JobAd object. | ||||||||||||||||
virtual | ~JobAd () throw () | |||||||||||||||
JobAd destructor. | ||||||||||||||||
JobAd (const std::string &jdl_string) | ||||||||||||||||
Instantiates a JobAd object from the given ClassAd-jdl string. | ||||||||||||||||
JobAd (const classad::ClassAd &classAd) | ||||||||||||||||
Constructor with a ClassAd instance. | ||||||||||||||||
JobAd (const JobAd &jobad) | ||||||||||||||||
Copy constructor. | ||||||||||||||||
void | operator= (const JobAd &jobad) | |||||||||||||||
Operator "=" performs a deep copy of the JobAd instance. | ||||||||||||||||
void | fromClassAd (const classad::ClassAd &classAd) | |||||||||||||||
Constructor with a ClassAd instance. | ||||||||||||||||
void | fromJobAd (const JobAd &jobad) | |||||||||||||||
Constructor with a JobAd instance. | ||||||||||||||||
String and Stream Constructor/Destructor | ||||||||||||||||
std::string | toSubmissionString () | |||||||||||||||
Convert the JobAd Instance into a single line string representation ready for submission. | ||||||||||||||||
void | toFile (const std::string &file_path) | |||||||||||||||
Put the JobAd Instance as a string into a file. | ||||||||||||||||
Insertion Methods | ||||||||||||||||
void | setLocalAccess (bool lookInto) | |||||||||||||||
If JobAd is used by a remove machine, it is impossible to look into the local hard-disk by default this parameter is set to true. | ||||||||||||||||
void | setDefaultRank (const std::string &attr_value) | |||||||||||||||
Set the default value for Rank attribute (take in consideration if not specified in JDL). | ||||||||||||||||
void | setDefaultReq (const std::string &attr_value) | |||||||||||||||
Set the default value for Requirements attribute (take in consideration if not specified in JDL). | ||||||||||||||||
void | setDefaultRank (classad::ExprTree *attr_value) | |||||||||||||||
Set the default value for Rank attribute (take in consideration if not specified in JDL). | ||||||||||||||||
void | setDefaultReq (classad::ExprTree *attr_value) | |||||||||||||||
Set the default value for Requirements attribute (take in consideration if not specified in JDL). | ||||||||||||||||
void | setAllowedProtocols (const std::vector< std::string > &attr_value) | |||||||||||||||
Add a list of protocols to the set of allowed inputsandbox protocols. | ||||||||||||||||
const std::vector< std::string > | getAllowedProtocols () | |||||||||||||||
Retrieve the list of all allowed protocols for inputsandbox URL format. | ||||||||||||||||
void | setAttributeExpr (const std::string &attr_name, const std::string &attr_value) | |||||||||||||||
Add The specified Expression Attribute to the jdl istance. | ||||||||||||||||
void | setAttributeExpr (const std::string &attr_name, ExprTree *attr_value) | |||||||||||||||
Add The specified Expression Attribute to the jdl istance. | ||||||||||||||||
Retrieval Methods | ||||||||||||||||
Ad | getAd (const std::string &attr_name) | |||||||||||||||
Retreive the value of the specified attribute. | ||||||||||||||||
std::string | getString (const std::string &attr_name) | |||||||||||||||
Retreive the value of the specified attribute. | ||||||||||||||||
int | getInt (const std::string &attr_name) | |||||||||||||||
Retreive the value of the specified attribute. | ||||||||||||||||
double | getDouble (const std::string &attr_name) | |||||||||||||||
Retreive the value of the specified attribute. | ||||||||||||||||
bool | getBool (const std::string &attr_name) | |||||||||||||||
Retreive the value of the specified attribute. | ||||||||||||||||
bool | gettoBretrieved () | |||||||||||||||
Return wheter are there any files to be retrieved This value has significant meaning only after a previous check. | ||||||||||||||||
ExtractedAd * | getExtractedAd () | |||||||||||||||
Retrieve the local files to be for the current instance. | ||||||||||||||||
Miscellaneous Methods | ||||||||||||||||
virtual void | checkSyntax (const std::string &attr_name, classad::ExprTree *attr_value) | |||||||||||||||
Check if the couple attribute/value is admitted. | ||||||||||||||||
virtual void | checkSyntax (const std::string &attr_name, classad::Value attr_value) | |||||||||||||||
void | checkMultiAttribute (const std::vector< std::string > &multi) | |||||||||||||||
Check if the Member/isMember expression is properly used in rank and requirements attributes expressions. | ||||||||||||||||
classad::ExprTree * | delAttribute (const std::string &attr_name) | |||||||||||||||
Delete an Attribute. | ||||||||||||||||
void | check (const bool &restore=true) | |||||||||||||||
Check the JobAd instance for both syntax and semanthic errors
| ||||||||||||||||
Protected Member Functions | ||||||||||||||||
virtual void | checkInputSandbox (std::vector< std::string > &extracted) | |||||||||||||||
check values inside inputsanbox attribute and if necessar/y extrapolate them. | ||||||||||||||||
virtual void | checkRankReq () | |||||||||||||||
Check and control Rank and Requirements attribute. | ||||||||||||||||
virtual void | insertAttribute (const std::string &attr_name, classad::ExprTree *val) | |||||||||||||||
Evaluate the specified expression and set is as the value of the specified attribute. | ||||||||||||||||
Protected Attributes | ||||||||||||||||
classad::ClassAd | user | |||||||||||||||
Analise a path and resolve the wildcards (if present) on it check the existence of (at least one file) the path. | ||||||||||||||||
checkType | lookInto_b | |||||||||||||||
decide whether to check file extistence (EXISTENCE) or not (WMPROXY) | ||||||||||||||||
bool | checking | |||||||||||||||
bool | toBretrieved | |||||||||||||||
boost::scoped_ptr< ExtractedAd > | extractedAd | |||||||||||||||
extracted local files | ||||||||||||||||
Friends | ||||||||||||||||
class | Job | |||||||||||||||
class | ExpDagAd |
Provides a representation of the job description in the JDL language and the functions for building and manipulating it.
Basically the JDL is the Condor ClassAd language, so it is legitimate the direct use of the Condor API library for creating, modifying, deleting a job description. However the JobAd class extends the ClassAd class of the Condor ClassAd library additionally providing some helper methods that ease the construction of job descriptions being fully compliant to WP1 WMS specification.
Provides a representation of the job description in the JDL language
glite::jdl::JobAd::JobAd | ( | ) |
Instantiates an empty JobAd object.
virtual glite::jdl::JobAd::~JobAd | ( | ) | throw () [virtual] |
JobAd destructor.
glite::jdl::JobAd::JobAd | ( | const std::string & | jdl_string | ) |
Instantiates a JobAd object from the given ClassAd-jdl string.
jdl_string | A string representig the description of the job |
glite::jdl::JobAd::JobAd | ( | const classad::ClassAd & | classAd | ) |
Constructor with a ClassAd instance.
classAd | the ClassAd instance where to build the JobAd from |
glite::jdl::JobAd::JobAd | ( | const JobAd & | jobad | ) |
Copy constructor.
jobad | a JobAd instance to be copied from |
void glite::jdl::JobAd::check | ( | const bool & | restore = true |
) |
Check the JobAd instance for both syntax and semanthic errors
AdMismatchException | A value is not of the right type for an attribute name in the JobAd | |
AdFormatException | A value is not in the right format for the an attribute name in the JobAd | |
AdSyntaxException | Syntax error catched while trying to add an attribute | |
AdClassAdException | a classAd method raised an error | |
AdListException | A list has been mad with a non-list value attribute. |
virtual void glite::jdl::JobAd::checkInputSandbox | ( | std::vector< std::string > & | extracted | ) | [protected, virtual] |
check values inside inputsanbox attribute and if necessar/y extrapolate them.
Could be inherited to change check
extracted | a vector containing all the found values |
Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.
void glite::jdl::JobAd::checkMultiAttribute | ( | const std::vector< std::string > & | multi | ) |
Check if the Member/isMember expression is properly used in rank and requirements attributes expressions.
multi | a vector containing all the attributes that could be of multiple value type |
AdSyntaxException | when the Member/IsMember expression is badly used |
virtual void glite::jdl::JobAd::checkRankReq | ( | ) | [protected, virtual] |
Check and control Rank and Requirements attribute.
could be inherited to change check
virtual void glite::jdl::JobAd::checkSyntax | ( | const std::string & | attr_name, | |
classad::Value | attr_value | |||
) | [virtual] |
Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.
virtual void glite::jdl::JobAd::checkSyntax | ( | const std::string & | attr_name, | |
classad::ExprTree * | attr_value | |||
) | [virtual] |
Check if the couple attribute/value is admitted.
attr_name | the name of the attribute | |
attr_value | a pointer to an ExprTree representing the value to be checkted |
AdMismatchException | The type of value is not allowed for the specified attribute name |
classad::ExprTree* glite::jdl::JobAd::delAttribute | ( | const std::string & | attr_name | ) | [virtual] |
Delete an Attribute.
It fails if the attribute doesn't exist
attr_name | The name of the attibute to be deleted |
AdEmptyException | The attribute has not been set yet |
Reimplemented from glite::jdl::Ad.
void glite::jdl::JobAd::fromClassAd | ( | const classad::ClassAd & | classAd | ) | [virtual] |
Constructor with a ClassAd instance.
classAd | the ClassAd instance where to build the JobAd from |
Reimplemented from glite::jdl::Ad.
Referenced by glite::jdl::NodeAd::NodeAd(), and glite::jdl::ParametricAd::ParametricAd().
void glite::jdl::JobAd::fromJobAd | ( | const JobAd & | jobad | ) |
Ad glite::jdl::JobAd::getAd | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The type of retrieved value is not allowed for the specified attribute name |
Reimplemented from glite::jdl::Ad.
const std::vector<std::string> glite::jdl::JobAd::getAllowedProtocols | ( | ) |
Retrieve the list of all allowed protocols for inputsandbox URL format.
bool glite::jdl::JobAd::getBool | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The type of retrieved value is not allowed for the specified attribute name |
Reimplemented from glite::jdl::Ad.
double glite::jdl::JobAd::getDouble | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The type of retrieved value is not allowed for the specified attribute name |
Reimplemented from glite::jdl::Ad.
ExtractedAd* glite::jdl::JobAd::getExtractedAd | ( | ) |
Retrieve the local files to be for the current instance.
int glite::jdl::JobAd::getInt | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The type of retrieved value is not allowed for the specified attribute name |
Reimplemented from glite::jdl::Ad.
std::string glite::jdl::JobAd::getString | ( | const std::string & | attr_name | ) | [virtual] |
Retreive the value of the specified attribute.
attr_name | The name of the attribute name to be retrieved |
AdEmptyException | The checked attribute has not been set yet | |
AdMismatchException | The type of retrieved value is not allowed for the specified attribute name |
Reimplemented from glite::jdl::Ad.
bool glite::jdl::JobAd::gettoBretrieved | ( | ) | [inline] |
Return wheter are there any files to be retrieved This value has significant meaning only after a previous check.
References toBretrieved.
virtual void glite::jdl::JobAd::insertAttribute | ( | const std::string & | attr_name, | |
classad::ExprTree * | val | |||
) | [protected, virtual] |
Evaluate the specified expression and set is as the value of the specified attribute.
attr_name | the name of the attribute to be set | |
val | the expression for the value to be set |
Reimplemented from glite::jdl::Ad.
Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.
void glite::jdl::JobAd::operator= | ( | const JobAd & | jobad | ) | [virtual] |
Operator "=" performs a deep copy of the JobAd instance.
Reimplemented from glite::jdl::Ad.
Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.
void glite::jdl::JobAd::setAllowedProtocols | ( | const std::vector< std::string > & | attr_value | ) |
Add a list of protocols to the set of allowed inputsandbox protocols.
attr_value | the list of protocol to be allowed for inputsandbox URL values |
void glite::jdl::JobAd::setAttributeExpr | ( | const std::string & | attr_name, | |
ExprTree * | attr_value | |||
) |
Add The specified Expression Attribute to the jdl istance.
attr_name | The Name of the attribute to be added | |
attr_value | The string expression of the attribute to be added |
AdMismatchException | The type of value is not allowed for the specified attribute name | |
AdClassAdException | a classAd method raised an error |
void glite::jdl::JobAd::setAttributeExpr | ( | const std::string & | attr_name, | |
const std::string & | attr_value | |||
) | [virtual] |
Add The specified Expression Attribute to the jdl istance.
attr_name | The Name of the attribute to be added | |
attr_value | The string expression of the attribute to be added |
AdMismatchException | The type of value is not allowed for the specified attribute name | |
AdClassAdException | a classAd method raised an error |
Reimplemented from glite::jdl::Ad.
void glite::jdl::JobAd::setDefaultRank | ( | classad::ExprTree * | attr_value | ) |
Set the default value for Rank attribute (take in consideration if not specified in JDL).
attr_value | the value to be set to the default rank |
void glite::jdl::JobAd::setDefaultRank | ( | const std::string & | attr_value | ) |
Set the default value for Rank attribute (take in consideration if not specified in JDL).
attr_value | the value to be set to the default rank |
void glite::jdl::JobAd::setDefaultReq | ( | classad::ExprTree * | attr_value | ) |
Set the default value for Requirements attribute (take in consideration if not specified in JDL).
attr_value | the value to be set to the default requirements |
void glite::jdl::JobAd::setDefaultReq | ( | const std::string & | attr_value | ) |
Set the default value for Requirements attribute (take in consideration if not specified in JDL).
attr_value | the value to be set to the default requirements |
void glite::jdl::JobAd::setLocalAccess | ( | bool | lookInto | ) |
If JobAd is used by a remove machine, it is impossible to look into the local hard-disk by default this parameter is set to true.
lookInto | allow all the check methods to access to the local hard disk (true) or skip the check (false) |
void glite::jdl::JobAd::toFile | ( | const std::string & | file_path | ) |
std::string glite::jdl::JobAd::toSubmissionString | ( | ) |
Convert the JobAd Instance into a single line string representation ready for submission.
friend class ExpDagAd [friend] |
Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.
friend class Job [friend] |
bool glite::jdl::JobAd::checking [protected] |
boost::scoped_ptr<ExtractedAd> glite::jdl::JobAd::extractedAd [protected] |
extracted local files
checkType glite::jdl::JobAd::lookInto_b [protected] |
decide whether to check file extistence (EXISTENCE) or not (WMPROXY)
bool glite::jdl::JobAd::toBretrieved [protected] |
Referenced by gettoBretrieved().
classad::ClassAd glite::jdl::JobAd::user [protected] |
Analise a path and resolve the wildcards (if present) on it check the existence of (at least one file) the path.
Leave URI/URL address unchanged
attr_name | the attribute to be checked (generally Sandbox values) | |
path | the path to be checked (could contain wildcards) | |
extracted | vector containing the extracted values | |
wmpUri | the WMProxyBaseUri attribute value | |
isbUri | an option parameter specifying the base path for non-local files |
void extractFiles(const std::string& attr_name,const std::string& path,std::vector<std::string> &extracted, const std::string &wmpUri="", const std::string &isbUri="") ; user classAd: classad containing all the attributes that could be possibly changed by the check method. This member is utilized in order to ripristinate (restore method ) the old classad situation