glite::jdl::JobAd Class Reference

#include <src/requestad/JobAd.h>

Inheritance diagram for glite::jdl::JobAd:

glite::jdl::Ad glite::jdl::NodeAd glite::jdl::ParametricAd

Detailed Description

Provides a representation of the job description in the JDL language and the functions for building and manipulating it.Provides a representation of the job description in the JDL language.

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.

Version:
0.1
Date:
15 April 2002
Author:
Alessandro Maraschini <alessandro.maraschini@datamat.it>


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.
ExtractedAdgetExtractedAd ()
 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
Exceptions:
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.


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
 user classAd: classad containing all the attributes that could be possibly changed by the check method.
checkType lookInto_b
 decide whether to check file extistence (EXISTENCE) or not (WMPROXY)
bool checking
bool toBretrieved
boost::scoped_ptr< ExtractedAdextractedAd
 extracted local files

Friends

class Job
class ExpDagAd


Constructor & Destructor Documentation

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.

Parameters:
jdl_string A string representig the description of the job

glite::jdl::JobAd::JobAd ( const classad::ClassAd &  classAd  ) 

Constructor with a ClassAd instance.

Parameters:
classAd the ClassAd instance where to build the JobAd from

glite::jdl::JobAd::JobAd ( const JobAd jobad  ) 

Copy constructor.

Parameters:
jobad a JobAd instance to be copied from


Member Function Documentation

void glite::jdl::JobAd::check ( const bool &  restore = true  ) 

Check the JobAd instance for both syntax and semanthic errors

Exceptions:
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

Parameters:
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.

Parameters:
multi a vector containing all the attributes that could be of multiple value type
Exceptions:
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.

Parameters:
attr_name the name of the attribute
attr_value a pointer to an ExprTree representing the value to be checkted
Exceptions:
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

Parameters:
attr_name The name of the attibute to be deleted
Returns:
a deep copy of the expression that has been just deleted for the specified attribute
Exceptions:
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.

Parameters:
classAd the ClassAd instance where to build the JobAd from

Reimplemented from glite::jdl::Ad.

void glite::jdl::JobAd::fromJobAd ( const JobAd jobad  ) 

Constructor with a JobAd instance.

Parameters:
jobad a JobAd instance to be copied

Ad glite::jdl::JobAd::getAd ( const std::string &  attr_name  )  [virtual]

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
the Ad instance for the specified attribute
Exceptions:
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.

Returns:
a vector containing all the protocols valid for the inputsandbox if provided with a URL format

bool glite::jdl::JobAd::getBool ( const std::string &  attr_name  )  [virtual]

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
the value of the specified attribute
Exceptions:
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.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
the value of the specified attribute
Exceptions:
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.

Returns:
a pointer to an ExtractedAd instance, containing all local files to be extracted

int glite::jdl::JobAd::getInt ( const std::string &  attr_name  )  [virtual]

Retreive the value of the specified attribute.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
the value of the specified attribute
Exceptions:
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.

Parameters:
attr_name The name of the attribute name to be retrieved
Returns:
the value of the specified attribute
Exceptions:
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.

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.

Parameters:
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  ) 

Operator "=" performs a deep copy of the JobAd instance.

void glite::jdl::JobAd::setAllowedProtocols ( const std::vector< std::string > &  attr_value  ) 

Add a list of protocols to the set of allowed inputsandbox protocols.

Parameters:
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.

Parameters:
attr_name The Name of the attribute to be added
attr_value The string expression of the attribute to be added
Exceptions:
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.

Parameters:
attr_name The Name of the attribute to be added
attr_value The string expression of the attribute to be added
Exceptions:
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).

Parameters:
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).

Parameters:
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).

Parameters:
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).

Parameters:
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.

Parameters:
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  ) 

Put the JobAd Instance as a string into a file.

Parameters:
file_path the string representation of the file where to copy the JobAd to

std::string glite::jdl::JobAd::toSubmissionString (  ) 

Convert the JobAd Instance into a single line string representation ready for submission.

Returns:
the string reoresentation that goes to the NetworkServer


Friends And Related Function Documentation

friend class ExpDagAd [friend]

Reimplemented in glite::jdl::NodeAd, and glite::jdl::ParametricAd.

friend class Job [friend]


Field Documentation

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]

classad::ClassAd glite::jdl::JobAd::user [protected]

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


The documentation for this class was generated from the following file:
Generated on Wed May 16 15:17:10 2012 for glite-jdl-api-cpp-3.2.5 by  doxygen 1.4.7