WorkflowExecutionEvent.h
1 
11 #ifndef WRENCH_WORKFLOWEXECUTIONEVENT_H
12 #define WRENCH_WORKFLOWEXECUTIONEVENT_H
13 
14 #include <string>
15 #include "FailureCause.h"
16 
17 /***********************/
19 /***********************/
20 
21 namespace wrench {
22 
23  class WorkflowTask;
24 
25  class WorkflowFile;
26 
27  class StandardJob;
28 
29  class PilotJob;
30 
31  class ComputeService;
32 
33  class StorageService;
34 
35  class FileRegistryService;
36 
37  class FileRegistryService;
38 
43  class WorkflowExecutionEvent {
44 
45  public:
46 
47  /***********************/
49  /***********************/
50  static std::shared_ptr<WorkflowExecutionEvent> waitForNextExecutionEvent(std::string);
51  static std::shared_ptr<WorkflowExecutionEvent> waitForNextExecutionEvent(std::string, double timeout);
52 
57  virtual std::string toString() { return "Generic WorkflowExecutionEvent"; }
58 
59  virtual ~WorkflowExecutionEvent() = default;
60 
61  protected:
62  WorkflowExecutionEvent() = default;
63 
64  /***********************/
66  /***********************/
67 
68 
69 
70  };
71 
72 
76  class StandardJobCompletedEvent : public WorkflowExecutionEvent {
77 
78  private:
79 
80  friend class WorkflowExecutionEvent;
81 
87  StandardJobCompletedEvent(StandardJob *standard_job,
88  std::shared_ptr<ComputeService> compute_service)
89  : standard_job(standard_job), compute_service(compute_service) {}
90  public:
91 
93  StandardJob *standard_job;
95  std::shared_ptr<ComputeService> compute_service;
96 
101  std::string toString() override { return "StandardJobCompletedEvent (job: " + this->standard_job->getName() + "; cs = " + this->compute_service->getName() + ")";}
102  };
103 
107  class StandardJobFailedEvent : public WorkflowExecutionEvent {
108 
109  private:
110 
111  friend class WorkflowExecutionEvent;
112 
119  StandardJobFailedEvent(StandardJob *standard_job,
120  std::shared_ptr<ComputeService> compute_service,
121  std::shared_ptr<FailureCause> failure_cause)
122  : standard_job(standard_job),
123  compute_service(compute_service),
124  failure_cause(failure_cause) {}
125 
126  public:
127 
129  StandardJob *standard_job;
131  std::shared_ptr<ComputeService> compute_service;
133  std::shared_ptr<FailureCause> failure_cause;
134 
139  std::string toString() override { return "StandardJobFailedEvent (job: " + this->standard_job->getName() + "; cs = " +
140  this->compute_service->getName() + "; cause: " + this->failure_cause->toString() + ")";}
141 
142  };
143 
144 
148  class PilotJobStartedEvent : public WorkflowExecutionEvent {
149 
150  private:
151 
152  friend class WorkflowExecutionEvent;
153 
159  PilotJobStartedEvent(PilotJob *pilot_job,
160  std::shared_ptr<ComputeService> compute_service)
161  : pilot_job(pilot_job), compute_service(compute_service) {}
162 
163  public:
165  PilotJob *pilot_job;
167  std::shared_ptr<ComputeService> compute_service;
168 
173  std::string toString() override { return "PilotJobStartedEvent (cs = " + this->compute_service->getName() + ")";}
174 
175  };
176 
180  class PilotJobExpiredEvent : public WorkflowExecutionEvent {
181 
182  private:
183 
184  friend class WorkflowExecutionEvent;
190  PilotJobExpiredEvent(PilotJob *pilot_job,
191  std::shared_ptr<ComputeService> compute_service)
192  : pilot_job(pilot_job), compute_service(compute_service) {}
193 
194  public:
195 
197  PilotJob *pilot_job;
199  std::shared_ptr<ComputeService> compute_service;
200 
205  std::string toString() override { return "PilotJobExpiredEvent (cs = " + this->compute_service->getName() + ")";}
206 
207  };
208 
212  class FileCopyCompletedEvent : public WorkflowExecutionEvent {
213 
214  private:
215 
216  friend class WorkflowExecutionEvent;
225  FileCopyCompletedEvent(WorkflowFile *file,
226  std::shared_ptr<FileLocation> src,
227  std::shared_ptr<FileLocation> dst,
228  std::shared_ptr<FileRegistryService> file_registry_service,
229  bool file_registry_service_updated)
230  : file(file), src(src), dst(dst),
231  file_registry_service(file_registry_service),
232  file_registry_service_updated(file_registry_service_updated) {}
233 
234  public:
236  WorkflowFile *file;
238  std::shared_ptr<FileLocation> src;
240  std::shared_ptr<FileLocation> dst;
242  std::shared_ptr<FileRegistryService> file_registry_service;
245 
250  std::string toString() override {
251  return "FileCopyCompletedEvent (file: " + this->file->getID() +
252  "; src = " + this->src->toString() +
253  "; dst = "+ this->dst->toString();
254  }
255 
256  };
257 
258 
262  class FileCopyFailedEvent : public WorkflowExecutionEvent {
263 
264  private:
265 
266  friend class WorkflowExecutionEvent;
274  FileCopyFailedEvent(WorkflowFile *file,
275  std::shared_ptr<FileLocation> src,
276  std::shared_ptr<FileLocation> dst,
277  std::shared_ptr<FailureCause> failure_cause
278  )
279  : file(file), src(src), dst(dst),
280  failure_cause(failure_cause) {}
281 
282  public:
283 
285  WorkflowFile *file;
287  std::shared_ptr<FileLocation> src;
289  std::shared_ptr<FileLocation> dst;
291  std::shared_ptr<FailureCause> failure_cause;
292 
297  std::string toString() override {
298  return "FileCopyFailedEvent (file: " + this->file->getID() +
299  "; src = " + this->src->toString() +
300  "; dst = " + this->dst->toString() +
301  "; cause: " + this->failure_cause->toString() + ")";}
302 
303  };
304 
308  class TimerEvent : public WorkflowExecutionEvent {
309 
310  private:
311 
312  friend class WorkflowExecutionEvent;
317  TimerEvent(std::string message)
318  : message(message) {}
319 
320  public:
321 
323  std::string message;
324 
329  std::string toString() override { return "TimerEvent (message: " + this->message + ")";}
330 
331  };
332 
333 };
334 
335 /***********************/
337 /***********************/
338 
339 
340 
341 #endif //WRENCH_WORKFLOWEXECUTIONEVENT_H
std::shared_ptr< FileLocation > src
The source location.
Definition: WorkflowExecutionEvent.h:287
A "pilot job has started" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:148
A "standard job has failed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:107
std::string message
The message.
Definition: WorkflowExecutionEvent.h:323
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:205
std::shared_ptr< ComputeService > compute_service
The compute service on which the pilot job has started.
Definition: WorkflowExecutionEvent.h:167
std::shared_ptr< FailureCause > failure_cause
The cause of the failure.
Definition: WorkflowExecutionEvent.h:133
std::shared_ptr< FileRegistryService > file_registry_service
The file registry service that was supposed to be updated (or nullptr if none)
Definition: WorkflowExecutionEvent.h:242
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:297
A "file copy has failed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:262
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:250
std::shared_ptr< FileLocation > dst
The destination location.
Definition: WorkflowExecutionEvent.h:289
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:329
WorkflowFile * file
The workflow file that has failed to be copied.
Definition: WorkflowExecutionEvent.h:285
StandardJob * standard_job
The standard job that has failed.
Definition: WorkflowExecutionEvent.h:129
bool file_registry_service_updated
Whether the file registry service (if any) has been successfully updated.
Definition: WorkflowExecutionEvent.h:244
std::shared_ptr< FileLocation > dst
The destination location.
Definition: WorkflowExecutionEvent.h:240
A "pilot job has expired" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:180
A "file copy has completed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:212
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:101
std::shared_ptr< FileLocation > src
The source location.
Definition: WorkflowExecutionEvent.h:238
A "timer went off" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:308
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:173
StandardJob * standard_job
The standard job that has completed.
Definition: WorkflowExecutionEvent.h:93
virtual std::string toString()=0
Return an error message that describes the failure cause (to be overridden)
std::shared_ptr< ComputeService > compute_service
The compute service on which the standard job has completed.
Definition: WorkflowExecutionEvent.h:95
PilotJob * pilot_job
The pilot job that has expired.
Definition: WorkflowExecutionEvent.h:197
WorkflowFile * file
The workflow file that has successfully been copied.
Definition: WorkflowExecutionEvent.h:236
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:139
std::shared_ptr< FailureCause > failure_cause
The cause of the failure.
Definition: WorkflowExecutionEvent.h:291
A "standard job has completed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:76
PilotJob * pilot_job
The pilot job that has started.
Definition: WorkflowExecutionEvent.h:165
std::shared_ptr< ComputeService > compute_service
The compute service on which the job has failed.
Definition: WorkflowExecutionEvent.h:131
std::shared_ptr< ComputeService > compute_service
The compute service on which the pilot job has expired.
Definition: WorkflowExecutionEvent.h:199
Definition: Alarm.cpp:19