WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
JobManager.h
1 
11 #ifndef WRENCH_PILOTJOBMANAGER_H
12 #define WRENCH_PILOTJOBMANAGER_H
13 
14 #include <vector>
15 #include <set>
16 
17 #include "wrench/services/Service.h"
18 
19 namespace wrench {
20 
21  class WMS;
22 
23  class Workflow;
24 
25  class WorkflowTask;
26 
27  class WorkflowFile;
28 
29  class WorkflowJob;
30 
31  class PilotJob;
32 
33  class StandardJob;
34 
35  class ComputeService;
36 
37  class StorageService;
38 
39  /***********************/
41  /***********************/
42 
43 
48  class JobManager : public Service {
49 
50  public:
51 
52 
53  void stop() override;
54 
55  void kill();
56 
57 
58  std::shared_ptr<StandardJob> createStandardJob(std::vector<WorkflowTask *> tasks,
59  std::map<WorkflowFile *, std::shared_ptr<FileLocation> > file_locations,
60  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation> >> pre_file_copies,
61  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation> >> post_file_copies,
62  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> >> cleanup_file_deletions);
63 
64  std::shared_ptr<StandardJob> createStandardJob(std::vector<WorkflowTask *> tasks,
65  std::map<WorkflowFile *, std::vector<std::shared_ptr<FileLocation>>> file_locations,
66  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation> >> pre_file_copies,
67  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation> >> post_file_copies,
68  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> >> cleanup_file_deletions);
69 
70 
71  std::shared_ptr<StandardJob> createStandardJob(std::vector<WorkflowTask *> tasks,
72  std::map<WorkflowFile *, std::shared_ptr<FileLocation>> file_locations);
73 
74  std::shared_ptr<StandardJob> createStandardJob(std::vector<WorkflowTask *> tasks,
75  std::map<WorkflowFile *, std::vector<std::shared_ptr<FileLocation>>> file_locations);
76 
77  std::shared_ptr<StandardJob> createStandardJob(WorkflowTask *task,
78  std::map<WorkflowFile *, std::shared_ptr<FileLocation>> file_locations);
79 
80  std::shared_ptr<StandardJob> createStandardJob(WorkflowTask *task,
81  std::map<WorkflowFile *, std::vector<std::shared_ptr<FileLocation>>> file_locations);
82 
83  std::shared_ptr<StandardJob> createStandardJob(std::vector<WorkflowTask *> tasks);
84 
85  std::shared_ptr<StandardJob> createStandardJob(WorkflowTask *task);
86 
87  std::shared_ptr<PilotJob> createPilotJob();
88 
89  void submitJob(std::shared_ptr<WorkflowJob> job, std::shared_ptr<ComputeService> compute_service,
90  std::map<std::string, std::string> service_specific_args = {});
91 
92  void terminateJob(std::shared_ptr<WorkflowJob> job);
93 
94 // void forgetJob(WorkflowJob *job);
95 
96  std::set<std::shared_ptr<PilotJob>> getPendingPilotJobs();
97 
98  std::set<std::shared_ptr<PilotJob>> getRunningPilotJobs();
99 
100  /***********************/
102  /***********************/
103 
104  ~JobManager() override;
105 
106  protected:
107 
108  friend class WMS;
109 
110  explicit JobManager(std::shared_ptr<WMS> wms);
111 
112  /***********************/
114  /***********************/
115 
116  private:
117 
118  int main() override;
119 
120  bool processNextMessage();
121 
122  void
123  processStandardJobCompletion(std::shared_ptr<StandardJob> job, std::shared_ptr<ComputeService> compute_service);
124 
125  void
126  processStandardJobFailure(std::shared_ptr<StandardJob> job, std::shared_ptr<ComputeService> compute_service,
127  std::shared_ptr<FailureCause> cause);
128 
129  void processPilotJobStart(std::shared_ptr<PilotJob> job, std::shared_ptr<ComputeService> compute_service);
130 
131  void processPilotJobExpiration(std::shared_ptr<PilotJob> job, std::shared_ptr<ComputeService> compute_service);
132 
133 
134  // Relevant WMS
135  std::shared_ptr<WMS> wms;
136 
137  // Job lists
138  std::set<std::shared_ptr<StandardJob>> new_standard_jobs;
139  std::set<std::shared_ptr<StandardJob>> pending_standard_jobs;
140  std::set<std::shared_ptr<StandardJob>> running_standard_jobs;
141  std::set<std::shared_ptr<StandardJob>> completed_standard_jobs;
142  std::set<std::shared_ptr<StandardJob>> failed_standard_jobs;
143 
144  std::set<std::shared_ptr<PilotJob>> new_pilot_jobs;
145  std::set<std::shared_ptr<PilotJob>> pending_pilot_jobs;
146  std::set<std::shared_ptr<PilotJob>> running_pilot_jobs;
147  std::set<std::shared_ptr<PilotJob>> completed_pilot_jobs;
148 
149  };
150 
151  /***********************/
153  /***********************/
154 
155 };
156 
157 #endif //WRENCH_PILOTJOBMANAGER_H
wrench
Definition: Alarm.cpp:20