ARC SDK
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
Arc::JobState Class Reference

#include <arc/compute/JobState.h>

Inheritance diagram for Arc::JobState:
Arc::JobStateTEST

Public Types

enum  StateType {
  UNDEFINED, ACCEPTED, PREPARING, SUBMITTING,
  HOLD, QUEUING, RUNNING, FINISHING,
  FINISHED, KILLED, FAILED, DELETED,
  OTHER
}
 Possible job states in libarccompute. More...
 

Public Member Functions

 JobState (const std::string &jobstate)
 Construct state from string. More...
 
JobStateoperator= (const JobState &js)
 
 operator bool () const
 
 operator StateType () const
 
bool operator! () const
 
bool operator== (const StateType &st) const
 
bool operator!= (const StateType &st) const
 
bool IsFinished () const
 Check if state is finished. More...
 
const std::string & operator() () const
 Unformatted specific job state. More...
 
const std::string & GetGeneralState () const
 General string representation of job state. More...
 
std::string GetSpecificState () const
 Specific string representation of job state. More...
 

Static Public Member Functions

static StateType GetStateType (const std::string &state)
 

Static Public Attributes

static const std::string StateTypeString []
 

Protected Types

typedef std::string(* SpecificStateFormater) (const std::string &)
 

Protected Member Functions

 JobState (const std::string &state, JobState::StateType(*map)(const std::string &), SpecificStateFormater ssf=FormatSpecificState)
 

Static Protected Member Functions

static std::string FormatSpecificState (const std::string &state)
 

Protected Attributes

SpecificStateFormater ssf
 
std::string state
 
StateType type
 

Friends

class Job
 

Detailed Description

libarccompute state model. The class comprise the general state model used by the libarccompute library. A JobState object has two attributes: A native state as a string, and a enum value specifying the mapping to the state model. Each job management extension (JobControllerPlugin specialisation), likely a implementation against a computing service, should define a mapping of the native job states to those in the libarccompute state model, which should then be used when constructing a JobState object for that specific extension. In that way both the general and the specific state is available.

A derived class should consist of a constructor and a mapping function (a JobStateMap) which maps a std::string to a JobState:StateType. An example of a constructor in a plugin could be: JobStatePlugin::JobStatePluging(const std::string& state) : JobState(state, &pluginStateMap) {} where &pluginStateMap is a reference to the JobStateMap defined by the derived class.

Documentation for mapping of job states for different computing services to those defined in this class can be found here.

Member Enumeration Documentation

◆ StateType

Possible job states in libarccompute.

The possible job states usable in the libarccompute library with a short description is listed below:

Enumerator
UNDEFINED 

Job state could not be resolved. Attribute mapping specific to this field/value.

ACCEPTED 

Job was accepted by the computing service. Attribute mapping specific to this field/value.

PREPARING 

Job is being prepared by the computing service. Attribute mapping specific to this field/value.

SUBMITTING 

Job is being submitted to a computing share. Attribute mapping specific to this field/value.

HOLD 

Job is put on hold. Attribute mapping specific to this field/value.

QUEUING 

Job is on computing share waiting to run. Attribute mapping specific to this field/value.

RUNNING 

Job is running on computing share. Attribute mapping specific to this field/value.

FINISHING 

Job is finishing. Attribute mapping specific to this field/value.

FINISHED 

Job has finished. Attribute mapping specific to this field/value.

KILLED 

Job has been killed. Attribute mapping specific to this field/value.

FAILED 

Job failed. Attribute mapping specific to this field/value.

DELETED 

Job have been deleted. Attribute mapping specific to this field/value.

OTHER 

Any job state which does not fit the above states. Attribute mapping specific to this field/value.

Constructor & Destructor Documentation

◆ JobState()

Arc::JobState::JobState ( const std::string &  jobstate)
inline

Construct state from string.

Since
Added in 4.0.0.

Member Function Documentation

◆ GetGeneralState()

const std::string& Arc::JobState::GetGeneralState ( ) const
inline

General string representation of job state.

Get the string representation of the job state as mapped to the libarccompute job state model.

Returns
string representing general job state
See also
enum StateType
GetSpecificState

◆ GetSpecificState()

std::string Arc::JobState::GetSpecificState ( ) const
inline

Specific string representation of job state.

Get the string representation of the job state as returned by the CE service possibly formatted to a human readable string.

Returns
string representing specific, possibly formatted, job state
See also
GetGeneralState
operator()

◆ IsFinished()

bool Arc::JobState::IsFinished ( ) const
inline

Check if state is finished.

Returns
true is returned if the StateType is equal to FINISHED, KILLED, FAILED or DELETED, otherwise false is returned.

◆ operator()()

const std::string& Arc::JobState::operator() ( ) const
inline

Unformatted specific job state.

Get the unformatted specific job state as returned by the CE.

Returns
job state as returned by CE
See also
GetSpecificState
GetGeneralState
Python interface deviation
Renamed to GetNativeState in Python interface

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