This file is indexed.

/usr/include/arc/compute/SubmitterPlugin.h is in nordugrid-arc-dev 5.0.5-1ubuntu1.

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
// -*- indent-tabs-mode: nil -*-

#ifndef __ARC_SUBMITTERPLUGIN_H__
#define __ARC_SUBMITTERPLUGIN_H__

/** \file
 * \brief Plugin, loader and argument classes for submitter specialisation.
 */

#include <list>
#include <map>
#include <string>

#include <arc/URL.h>
#include <arc/loader/Loader.h>
#include <arc/loader/Plugin.h>
#include <arc/compute/EntityRetriever.h>
#include <arc/compute/Job.h>
#include <arc/compute/JobDescription.h>
#include <arc/compute/SubmissionStatus.h>
#include <arc/data/DataHandle.h>

namespace Arc {

  /**
   * \defgroup accplugins Plugin related classes for compute specialisations
   * \ingroup compute
   */

  class Config;
  class ExecutionTarget;
  class JobDescription;
  class Logger;
  class UserConfig;

  /// Base class for the SubmitterPlugins
  /**
   * SubmitterPlugin is the base class for Grid middleware specialized
   * SubmitterPlugin objects. The class submits job(s) to the computing
   * resource it represents and uploads (needed by the job) local
   * input files.
   *
   * \headerfile SubmitterPlugin.h arc/compute/SubmitterPlugin.h
   */
  class SubmitterPlugin : public Plugin {
  protected:
    SubmitterPlugin(const UserConfig& usercfg, PluginArgument* parg)
      : Plugin(parg), usercfg(usercfg), dest_handle(NULL) {}
  public:
    virtual ~SubmitterPlugin() { delete dest_handle; }

    /// Submit a single job description
    /**
     * Convenience method for submitting single job description, it simply calls
     * the SubmitterPlugin::Submit method taking a list of job descriptions.
     * \param j JobDescription object to be submitted.
     * \param et ExecutionTarget to submit the job description to.
     * \param jc callback object used to add Job object of newly submitted job
     *        to.
     * \return a bool indicating whether job submission suceeded or not.
     **/
    virtual SubmissionStatus Submit(const JobDescription& j, const ExecutionTarget& et, EntityConsumer<Job>& jc) { std::list<const JobDescription*> ns; return Submit(std::list<JobDescription>(1, j), et, jc, ns); }

    /// Submit job
    /**
     * This virtual method should be overridden by plugins which should
     * be capable of submitting jobs, defined in the JobDescription
     * jobdesc, to the ExecutionTarget et. The protected convenience
     * method AddJob can be used to save job information.
     * This method should return the URL of the submitted job. In case
     * submission fails an empty URL should be returned.
     */
    virtual SubmissionStatus Submit(const std::list<JobDescription>& jobdesc,
                                    const ExecutionTarget& et,
                                    EntityConsumer<Job>& jc,
                                    std::list<const JobDescription*>& notSubmitted) = 0;
    virtual SubmissionStatus Submit(const std::list<JobDescription>& jobdesc,
                                    const std::string& endpoint,
                                    EntityConsumer<Job>& jc,
                                    std::list<const JobDescription*>& notSubmitted);


    /// Migrate job
    /**
     * This virtual method should be overridden by plugins which should
     * be capable of migrating jobs. The active job which should be
     * migrated is pointed to by the URL jobid, and is represented by
     * the JobDescription jobdesc. The forcemigration boolean specifies
     * if the migration should succeed if the active job cannot be
     * terminated. The protected method AddJob can be used to save job
     * information.
     * This method should return the URL of the migrated job. In case
     * migration fails an empty URL should be returned.
     */
    virtual bool Migrate(const std::string& jobid, const JobDescription& jobdesc,
                         const ExecutionTarget& et,
                         bool forcemigration, Job& job);

    virtual const std::list<std::string>& SupportedInterfaces() const { return supportedInterfaces; };

  protected:
    bool PutFiles(const JobDescription& jobdesc, const URL& url) const;
    void AddJobDetails(const JobDescription& jobdesc, Job& job) const;

    const UserConfig& usercfg;
    std::list<std::string> supportedInterfaces;
    DataHandle* dest_handle;

    static Logger logger;
  };

  /** Class responsible for loading SubmitterPlugin plugins
   * The SubmitterPlugin objects returned by a SubmitterPluginLoader
   * must not be used after the SubmitterPluginLoader is destroyed.
   *
   * \ingroup accplugins
   * \headerfile SubmitterPlugin.h arc/compute/SubmitterPlugin.h
   */
  class SubmitterPluginLoader : public Loader {
  public:
    /** Constructor
     * Creates a new SubmitterPluginLoader.
     */
    SubmitterPluginLoader();

    /** Destructor
     * Calling the destructor destroys all SubmitterPlugins loaded
     * by the SubmitterPluginLoader instance.
     */
    ~SubmitterPluginLoader();

    /** Load a new SubmitterPlugin
     * \param name    The name of the SubmitterPlugin to load.
     * \param usercfg The UserConfig object for the new SubmitterPlugin.
     * \return A pointer to the new SubmitterPlugin (NULL on error).
     */
    SubmitterPlugin* load(const std::string& name, const UserConfig& usercfg);

    SubmitterPlugin* loadByInterfaceName(const std::string& name, const UserConfig& usercfg);

    void initialiseInterfacePluginMap(const UserConfig& uc);
    const std::map<std::string, std::string>& getInterfacePluginMap() const { return interfacePluginMap; }

  private:
    std::multimap<std::string, SubmitterPlugin*> submitters;
    static std::map<std::string, std::string> interfacePluginMap;
  };

  /**
   * \ingroup accplugins
   * \headerfile SubmitterPlugin.h arc/compute/SubmitterPlugin.h
   */
  class SubmitterPluginArgument
    : public PluginArgument {
  public:
    SubmitterPluginArgument(const UserConfig& usercfg)
      : usercfg(usercfg) {}
    ~SubmitterPluginArgument() {}
    operator const UserConfig&() {
      return usercfg;
    }
  private:
    const UserConfig& usercfg;
  };

} // namespace Arc

#endif // __ARC_SUBMITTERPLUGIN_H__