jdl-api-cpp-3.4.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
glite::jdl::JobAd Class Reference

Provides a representation of the job description in the JDL language. More...

#include <glite/jdl/JobAd.h>

Inheritance diagram for glite::jdl::JobAd:
glite::jdl::Ad glite::jdl::NodeAd glite::jdl::ParametricAd

Public Member Functions

Constructors/Destructor
 JobAd ()
 
virtual ~JobAd () throw ()
 
 JobAd (const std::string &jdl_string)
 
 JobAd (const classad::ClassAd &classAd)
 
 JobAd (const JobAd &jobad)
 
void operator= (const JobAd &jobad)
 
void fromClassAd (const classad::ClassAd &classAd)
 
void fromJobAd (const JobAd &jobad)
 
String and Stream Constructor/Destructor
std::string toSubmissionString ()
 
void toFile (const std::string &file_path)
 
Insertion Methods
void setLocalAccess (bool lookInto)
 
void setDefaultRank (const std::string &attr_value)
 
void setDefaultReq (const std::string &attr_value)
 
void setDefaultRank (classad::ExprTree *attr_value)
 
void setDefaultReq (classad::ExprTree *attr_value)
 
void setAllowedProtocols (const std::vector< std::string > &attr_value)
 
const std::vector< std::string > getAllowedProtocols ()
 
void setAttributeExpr (const std::string &attr_name, const std::string &attr_value)
 
void setAttributeExpr (const std::string &attr_name, ExprTree *attr_value)
 
Retrieval Methods
Ad getAd (const std::string &attr_name)
 
std::string getString (const std::string &attr_name)
 
int getInt (const std::string &attr_name)
 
double getDouble (const std::string &attr_name)
 
bool getBool (const std::string &attr_name)
 
bool gettoBretrieved ()
 
ExtractedAdgetExtractedAd ()
 
Miscellaneous Methods
virtual void checkSyntax (const std::string &attr_name, classad::ExprTree *attr_value)
 
virtual void checkSyntax (const std::string &attr_name, classad::Value attr_value)
 
void checkMultiAttribute (const std::vector< std::string > &multi)
 
classad::ExprTree * delAttribute (const std::string &attr_name)
 
void check (const bool &restore=true)
 
- Public Member Functions inherited from glite::jdl::Ad
 Ad ()
 
virtual ~Ad () throw ()
 
 Ad (const classad::ClassAd &classAd)
 
 Ad (const std::string &jdl_string)
 
 Ad (const Ad &jobad)
 
virtual void operator= (const Ad &jobad)
 
void fromString (const std::string &jdl_string, std::string jdl_file="")
 
void fromFile (const std::string &jdl_file)
 
void fromStream (std::istream &jdl_in)
 
virtual std::string toString ()
 
virtual std::string toString (const std::string &attr_name)
 
virtual std::string toLines ()
 
bool isSet ()
 
void clear ()
 
classad::ClassAd *const ad ()
 
bool hasAttribute (const std::string &attr_name)
 
void remAttribute (const std::string &attr_name)
 
virtual classad::ExprTree * lookUp (const std::string &attr_name)
 
bool hasAttribute (const std::string &attr_name, const std::string &attr_value)
 
std::vector< std::string > attributes ()
 
void merge (Ad source, bool overwrite=true)
 
bool hasWarnings ()
 
std::vector< std::string > getWarnings ()
 
void addWarning (const std::string &msg)
 
int getType (const std::string &attr_name)
 
void addAttribute (const std::string &attr_name, int attr_value)
 
void addAttribute (const std::string &attr_name, double attr_value)
 
void addAttribute (const std::string &attr_name, bool attr_value)
 
void addAttribute (const std::string &attr_name, const std::string &attr_value)
 
void addAttribute (const std::string &attr_name, const char *attr_value)
 
void addAttribute (const std::string &attr_name, Ad *attr_value)
 
virtual void setAttribute (const std::string &attr_name, int attr_value)
 
virtual void setAttribute (const std::string &attr_name, const std::string &attr_value)
 
virtual void setAttribute (const std::string &attr_name, const char *attr_value)
 
virtual void setAttribute (const std::string &attr_name, double attr_value)
 
virtual void setAttribute (const std::string &attr_name, bool attr_value)
 
virtual void setAttribute (const std::string &attr_name, Ad *attr_value)
 
virtual void setAttributeExpr (const std::string &attr_name, classad::ExprTree *attr_value)
 
virtual std::string getAttributeExpr (const std::string &attr_name)
 
std::vector< int > getIntValue (const std::string &attr_name)
 
std::vector< double > getDoubleValue (const std::string &attr_name)
 
std::vector< bool > getBoolValue (const std::string &attr_name)
 
virtual std::vector< std::string > getStringValue (const std::string &attr_name)
 
std::vector< std::vector
< std::string > > 
getStringList (const std::string &attr_name)
 

Protected Member Functions

virtual void checkInputSandbox (std::vector< std::string > &extracted)
 
virtual void checkRankReq ()
 
virtual void insertAttribute (const std::string &attr_name, classad::ExprTree *val)
 
- Protected Member Functions inherited from glite::jdl::Ad
virtual void addAttribute (std::string attr_name, classad::Value val)
 
virtual void appendValue (classad::ExprTree *tree, const classad::Value &val, const std::string &attr_name)
 
virtual void insertAttribute (const std::string &attr_name, classad::Value val)
 
virtual classad::Value getTypeValue (const std::string &attr_name)
 
bool hasAttribute (classad::ExprTree *tree, const std::string &attr_value)
 

Protected Attributes

classad::ClassAd user
 
checkType lookInto_b
 
bool checking
 
bool toBretrieved
 
boost::scoped_ptr< ExtractedAdextractedAd
 
- Protected Attributes inherited from glite::jdl::Ad
std::vector< std::string > warning_messages_v
 

Friends

class Job
 
class ExpDagAd
 

Detailed Description

Provides a representation of the job description in the JDL language.

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.

Version
0.1
Date
15 April 2002
Author
Alessandro Maraschini aless.nosp@m.andr.nosp@m.o.mar.nosp@m.asch.nosp@m.ini@d.nosp@m.atam.nosp@m.at.it

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_stringA string representig the description of the job
glite::jdl::JobAd::JobAd ( const classad::ClassAd &  classAd)

Constructor with a ClassAd instance

Parameters
classAdthe ClassAd instance where to build the JobAd from
glite::jdl::JobAd::JobAd ( const JobAd jobad)

Copy constructor

Parameters
jobada 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
AdMismatchExceptionA value is not of the right type for an attribute name in the JobAd
AdFormatExceptionA value is not in the right format for the an attribute name in the JobAd
AdSyntaxExceptionSyntax error catched while trying to add an attribute
AdClassAdExceptiona classAd method raised an error
AdListExceptionA list has been mad with a non-list value attribute
virtual void glite::jdl::JobAd::checkInputSandbox ( std::vector< std::string > &  extracted)
protectedvirtual

check values inside inputsanbox attribute and if necessar/y extrapolate them. Could be inherited to change check

Parameters
extracteda 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
multia vector containing all the attributes that could be of multiple value type
Exceptions
AdSyntaxExceptionwhen the Member/IsMember expression is badly used
virtual void glite::jdl::JobAd::checkRankReq ( )
protectedvirtual

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::ExprTree *  attr_value 
)
virtual

Check if the couple attribute/value is admitted

Parameters
attr_namethe name of the attribute
attr_valuea pointer to an ExprTree representing the value to be checkted
Exceptions
AdMismatchExceptionThe type of value is not allowed for the specified attribute name
virtual void glite::jdl::JobAd::checkSyntax ( const std::string &  attr_name,
classad::Value  attr_value 
)
virtual
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_nameThe name of the attibute to be deleted
Returns
a deep copy of the expression that has been just deleted for the specified attribute
Exceptions
AdEmptyExceptionThe 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
classAdthe 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)

Constructor with a JobAd instance

Parameters
jobada 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_nameThe name of the attribute name to be retrieved
Returns
the Ad instance for the specified attribute
Exceptions
AdEmptyExceptionThe checked attribute has not been set yet
AdMismatchExceptionThe 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_nameThe name of the attribute name to be retrieved
Returns
the value of the specified attribute
Exceptions
AdEmptyExceptionThe checked attribute has not been set yet
AdMismatchExceptionThe 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_nameThe name of the attribute name to be retrieved
Returns
the value of the specified attribute
Exceptions
AdEmptyExceptionThe checked attribute has not been set yet
AdMismatchExceptionThe 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_nameThe name of the attribute name to be retrieved
Returns
the value of the specified attribute
Exceptions
AdEmptyExceptionThe checked attribute has not been set yet
AdMismatchExceptionThe 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_nameThe name of the attribute name to be retrieved
Returns
the value of the specified attribute
Exceptions
AdEmptyExceptionThe checked attribute has not been set yet
AdMismatchExceptionThe 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 
)
protectedvirtual

Evaluate the specified expression and set is as the value of the specified attribute

Parameters
attr_namethe name of the attribute to be set
valthe 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_valuethe list of protocol to be allowed for inputsandbox URL values
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_nameThe Name of the attribute to be added
attr_valueThe string expression of the attribute to be added
Exceptions
AdMismatchExceptionThe type of value is not allowed for the specified attribute name
AdClassAdExceptiona classAd method raised an error

Reimplemented from glite::jdl::Ad.

void glite::jdl::JobAd::setAttributeExpr ( const std::string &  attr_name,
ExprTree *  attr_value 
)

Add The specified Expression Attribute to the jdl istance

Parameters
attr_nameThe Name of the attribute to be added
attr_valueThe string expression of the attribute to be added
Exceptions
AdMismatchExceptionThe type of value is not allowed for the specified attribute name
AdClassAdExceptiona classAd method raised an error
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_valuethe value to be set to the default rank
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_valuethe value to be set to the default rank
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_valuethe value to be set to the default requirements
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_valuethe 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
lookIntoallow 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_paththe 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
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

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

Parameters
attr_namethe attribute to be checked (generally Sandbox values)
paththe path to be checked (could contain wildcards)
extractedvector containing the extracted values
wmpUrithe WMProxyBaseUri attribute value
isbUrian option parameter specifying the base path for non-local files
Returns
the vector with the extracted 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


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