This file is indexed.

/usr/include/arc/compute/JobState.h is in nordugrid-arc-dev 4.2.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#ifndef __ARC_JOBSTATE_H__
#define __ARC_JOBSTATE_H__

#include <string>
#include <map>

#ifdef JOBSTATE_TABLE
#undef JOBSTATE_TABLE
#endif

#ifdef JOBSTATE_X
#undef JOBSTATE_X
#endif

namespace Arc {

  /** 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 \subpage job_state_mapping "here".
   * 
   * \ingroup compute
   * \headerfile JobState.h arc/compute/JobState.h 
   */
  class JobState {
  public:
    /** \enum StateType
     * \brief Possible job states in libarccompute
     * 
     * The possible job states usable in the libarccompute library with a short
     * description is listed below:
     * 
     * \mapdef job_state_mapping Job state mapping
     * On this page the mapping of job state attributes of different
     * computing services to those defined by the libarccompute library in the
     * \ref Arc::JobState "JobState" class is documented.
     **/
    enum StateType {
      /** %Job state could not be resolved.
       * \mapdefattr UNDEFINED Arc::JobState
       **/
      UNDEFINED,
      
      /** %Job was accepted by the computing service.
       * \mapdefattr ACCEPTED Arc::JobState
       */
      ACCEPTED,
      
      /** %Job is being prepared by the computing service.
       * \mapdefattr PREPARING Arc::JobState
       **/
      PREPARING,

      /** %Job is being submitted to a computing share.
       * \mapdefattr SUBMITTING Arc::JobState
       **/
      SUBMITTING,
      
      /** %Job is put on hold.
       * \mapdefattr HOLD Arc::JobState
       **/
      HOLD,
      
      /** %Job is on computing share waiting to run.
       * \mapdefattr QUEUING Arc::JobState
       **/
      QUEUING,
      
      /** %Job is running on computing share.
       * \mapdefattr RUNNING Arc::JobState
       **/
      RUNNING,
      
      /** %Job is finishing.
       * \mapdefattr FINISHING Arc::JobState
       **/
      FINISHING,
      
      /** %Job has finished.
       * \mapdefattr FINISHED Arc::JobState
       **/
      FINISHED,
      
      /** %Job has been killed.
       * \mapdefattr KILLED Arc::JobState
       **/
      KILLED,
      
      /** %Job failed.
       * \mapdefattr FAILED Arc::JobState
       **/
      FAILED,
      
      /** %Job have been deleted.
       * \mapdefattr DELETED Arc::JobState
       **/
      DELETED,
      
      /** Any job state which does not fit the above states.
       * \mapdefattr OTHER Arc::JobState
       **/
      OTHER
    };

    static const std::string StateTypeString[];

    JobState() : ssf(FormatSpecificState), type(UNDEFINED) {}
    /// Construct state from string
    /**
     * \since Added in 4.0.0.
     **/
    JobState(const std::string& jobstate) : ssf(FormatSpecificState), state(jobstate), type(GetStateType(jobstate)) {}
    
    JobState& operator=(const JobState& js) { type = js.type; state = js.state; ssf = js.ssf; return *this; }

    operator bool() const { return type != UNDEFINED; }
    operator StateType() const { return type; }
    bool operator!() const { return type == UNDEFINED; }
    bool operator==(const StateType& st) const { return type == st; }
    bool operator!=(const StateType& st) const { return type != st; }

    /// Check if state is finished
    /**
     * @return true is returned if the StateType is equal to FINISHED, KILLED,
     *  FAILED or DELETED, otherwise false is returned.
     **/
    bool IsFinished() const { return type == FINISHED || type == KILLED || type == FAILED || type == DELETED; }

    /// Unformatted specific job state
    /**
     * Get the unformatted specific job state as returned by the CE.
     * 
     * @return job state as returned by CE
     * @see GetSpecificState
     * @see GetGeneralState
     **/
    const std::string& operator()() const { return state; }

    /// General string representation of job state
    /**
     * Get the string representation of the job state as mapped to the
     * libarccompute job state model.
     * 
     * @return string representing general job state
     * @see enum StateType
     * @see GetSpecificState
     **/
    const std::string& GetGeneralState() const { return StateTypeString[type]; }
    
    /// 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.
     * 
     * @return string representing specific, possibly formatted, job state
     * @see GetGeneralState
     * @see operator()
     **/
    std::string GetSpecificState() const { return ssf(state); }

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

    friend class Job;

  protected:
    typedef std::string (*SpecificStateFormater)(const std::string&);
    SpecificStateFormater ssf;
    static std::string FormatSpecificState(const std::string& state) { return state; }
    
    JobState(const std::string& state, JobState::StateType (*map)(const std::string&), SpecificStateFormater ssf = FormatSpecificState)
      : ssf(ssf), state(state), type((*map)(state)) {};
    std::string state;
    StateType type;
  };

  /**
   * \ingroup compute
   * \headerfile JobState.h arc/compute/JobState.h 
   */
  typedef JobState::StateType (*JobStateMap)(const std::string&);
}

#endif // __ARC_JOBSTATE_H__