ARC SDK
Public Member Functions | Static Public Member Functions | Data Fields | Friends

#include <arc/compute/JobDescription.h>

Public Member Functions

 JobDescription (const JobDescription &j, bool withAlternatives=true)
 
 JobDescription (const long int &ptraddr)
 
JobDescriptionoperator= (const JobDescription &j)
 
void AddAlternative (const JobDescription &j)
 
bool HasAlternatives () const
 
const std::list< JobDescription > & GetAlternatives () const
 
std::list< JobDescription > & GetAlternatives ()
 
std::list< JobDescriptionGetAlternativesCopy () const
 
bool UseAlternative ()
 
void UseOriginal ()
 
void RemoveAlternatives ()
 
JobDescriptionResult UnParse (std::string &product, std::string language, const std::string &dialect="") const
 Output contents in the specified language. More...
 
const std::string & GetSourceLanguage () const
 Get input source language. More...
 
JobDescriptionResult SaveToStream (std::ostream &out, const std::string &format) const
 Print job description to a std::ostream object. More...
 
bool Prepare (const ExecutionTarget &et)
 Prepare for submission to target. More...
 
bool Prepare ()
 

Static Public Member Functions

static JobDescriptionResult Parse (const std::string &source, std::list< JobDescription > &jobdescs, const std::string &language="", const std::string &dialect="")
 Parse string into JobDescription objects. More...
 
static JobDescriptionResult ParseFromFile (const std::string &filename, std::list< JobDescription > &jobdescs, const std::string &language="", const std::string &dialect="")
 
static bool GetTestJob (int testid, JobDescription &jobdescription)
 

Data Fields

JobIdentificationType Identification
 Structure for identification. More...
 
ApplicationType Application
 Structure for apllication options. More...
 
ResourcesType Resources
 Structure for resource requirements. More...
 
DataStagingType DataStaging
 Structure for data staging. More...
 
std::map< std::string,
std::string > 
OtherAttributes
 Holds attributes not fitting into this class. More...
 

Friends

class JobDescriptionParserPlugin
 

Detailed Description

The JobDescription class is the internal representation of a job description in the ARC-lib. It is structured into a number of other classes/objects which should strictly follow the description given in the job description document http://svn.nordugrid.org/trac/nordugrid/browser/arc1/trunk/doc/tech_doc/client/job_description.odt.

The class consist of a parsing method JobDescription::Parse which tries to parse the passed source using a number of different parsers. The parser method is complemented by the JobDescription::UnParse method, a method to generate a job description document in one of the supported formats. Additionally the internal representation is contained in public members which makes it directly accessible and modifiable from outside the scope of the class.

Member Function Documentation

const std::string& Arc::JobDescription::GetSourceLanguage ( ) const
inline

Get input source language.

If this object was created by a JobDescriptionParserPlugin, then this method returns a string which indicates the job description language of the parsed source. If not created by a JobDescripionParser the string returned is empty.

Returns
const std::string& source langauge of parsed input source.
static JobDescriptionResult Arc::JobDescription::Parse ( const std::string &  source,
std::list< JobDescription > &  jobdescs,
const std::string &  language = "",
const std::string &  dialect = "" 
)
static

Parse string into JobDescription objects.

The passed string will be tried parsed into the list of JobDescription objects. The available specialized JobDesciptionParser classes will be tried one by one, parsing the string, and if one succeeds the list of JobDescription objects is filled with the parsed contents and true is returned, otherwise false is returned. If no language specified, each JobDescriptionParserPlugin will try all its supported languages. On the other hand if a language is specified, only the JobDescriptionParserPlugin supporting that language will be tried. A dialect can also be specified, which only has an effect on the parsing if the JobDescriptionParserPlugin supports that dialect.

Parameters
source
jobdescs
language
dialect
Returns
true if the passed string can be parsed successfully by any of the available parsers.
bool Arc::JobDescription::Prepare ( const ExecutionTarget et)
inline

Prepare for submission to target.

The Prepare method, is used to check and adapt the JobDescription object to the passed ExecutionTarget object before submitting the job description to the target. This method is normally called by SubmitterPlugin plugin classes, before submitting the job description. First the method checks the DataStaging.InputFiles list, for identical file names, and non-existent local input files. If any of such files are found, the method returns false. Then if the Application.Executable and Application.Input objects are specified as local input files, and they are not among the files in the DataStaging.InputFiles list a existence check will be done and if not found, false will be returned, otherwise they will be added to the list. Likewise if the Application.Output, Application.Error and Application.LogDir attributes have been specified, and is not among the files in the DataStaging.OutputFiles list, they will be added to this list. After the file check, the Resources.RunTimeEnvironment, Resources.CEType and Resources.OperatingSystem SoftwareRequirement objects are respectively resolved against the ExecutionTarget::ApplicationEnvironments, ExecutionTarget::Implementation and ExecutionTarget::OperatingSystem Software objects using the SoftwareRequirement::selectSoftware method. If that method returns false i.e. unable to resolve the requirements false will be returned. After resolving software requirements, the value of the Resources.QueueName attribute will be set to that of the ExecutionTarget::ComputingShareName attribute, and then true is returned.

Parameters
etExecutionTarget object which to resolve software requirements against, and to pick up queue name from.
Returns
false is returned is file checks fails, or if unable to resolve software requirements.
JobDescriptionResult Arc::JobDescription::SaveToStream ( std::ostream &  out,
const std::string &  format 
) const

Print job description to a std::ostream object.

The job description will be written to the passed std::ostream object out in the format indicated by the format parameter. The format parameter should specify the format of one of the job description languages supported by the library. Or by specifying the special "user" or "userlong" format the job description will be written as a attribute/value pair list with respectively less or more attributes.

The mote

Returns
true if writing the job description to the out object succeeds, otherwise false.
Parameters
outa std::ostream reference specifying the ostream to write the job description to.
formatspecifies the format the job description should written in.
JobDescriptionResult Arc::JobDescription::UnParse ( std::string &  product,
std::string  language,
const std::string &  dialect = "" 
) const

Output contents in the specified language.

Parameters
product
language
dialect
Returns

Field Documentation

ApplicationType Arc::JobDescription::Application

Structure for apllication options.

All options relating to the application is stored in this structure.

Java interface deviation
The member is only accessible through the getApplication and setApplication methods in the Java interface
DataStagingType Arc::JobDescription::DataStaging

Structure for data staging.

Input files requirements, and destinations for output files can be specified using this structure.

Java interface deviation
The member is only accessible through the getDataStaging and setDataStaging methods in the Java interface
JobIdentificationType Arc::JobDescription::Identification

Structure for identification.

This member object stores information which can be used to identify the job description.

Java interface deviation
The member is only accessible through the getIdentification and setIdentification methods in the Java interface
std::map<std::string, std::string> Arc::JobDescription::OtherAttributes

Holds attributes not fitting into this class.

This member is used by JobDescriptionParserPlugin classes to store attribute/value pairs not fitting into attributes stored in this class. The form of the attribute (the key in the map) should be as follows:

<language>;<attribute-name>

E.g.: "nordugrid:xrsl;hostname".

Java interface deviation
The member is only accessible through the getOtherAttributes and setOtherAttributes methods in the Java interface
ResourcesType Arc::JobDescription::Resources

Structure for resource requirements.

This structure specifies requirements which should be satisfied before application can be started.

Java interface deviation
The member is only accessible through the getResources and setResources methods in the Java interface

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