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 
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 
77 
78  private:
79 
80  friend class WorkflowExecutionEvent;
81 
88  std::shared_ptr<ComputeService> compute_service)
89  : standard_job(standard_job), compute_service(compute_service) {}
90  public:
91 
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 
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 
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 
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:
167  std::shared_ptr<ComputeService> compute_service;
168 
173  std::string toString() override { return "PilotJobStartedEvent (cs = " + this->compute_service->getName() + ")";}
174 
175  };
176 
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 
199  std::shared_ptr<ComputeService> compute_service;
200 
205  std::string toString() override { return "PilotJobExpiredEvent (cs = " + this->compute_service->getName() + ")";}
206 
207  };
208 
213 
214  private:
215 
216  friend class WorkflowExecutionEvent;
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:
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 
263 
264  private:
265 
266  friend class WorkflowExecutionEvent;
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 
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 
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
virtual std::string toString()
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:57
A class to represent the various execution events that are relevant to the execution of a workflow...
Definition: WorkflowExecutionEvent.h:43
std::string getID()
Get the file id.
Definition: WorkflowFile.cpp:44
A "standard job has completed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:76
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:250
A "file copy has completed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:212
std::string message
The message.
Definition: WorkflowExecutionEvent.h:323
WorkflowFile * file
The workflow file that has successfully been copied.
Definition: WorkflowExecutionEvent.h:236
std::shared_ptr< FailureCause > failure_cause
The cause of the failure.
Definition: WorkflowExecutionEvent.h:291
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
A "standard job has failed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:107
A "file copy has failed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:262
static std::shared_ptr< WorkflowExecutionEvent > waitForNextExecutionEvent(std::string)
Block the calling process until a WorkflowExecutionEvent is generated based on messages received on a...
Definition: WorkflowExecutionEvent.cpp:37
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:205
A "pilot job has started" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:148
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:297
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:173
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
std::shared_ptr< FailureCause > failure_cause
The cause of the failure.
Definition: WorkflowExecutionEvent.h:133
std::shared_ptr< ComputeService > compute_service
The compute service on which the pilot job has expired.
Definition: WorkflowExecutionEvent.h:199
A pilot (i.e., non-standard) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: PilotJob.h:29
A standard (i.e., non-pilot) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: StandardJob.h:38
StandardJob * standard_job
The standard job that has failed.
Definition: WorkflowExecutionEvent.h:129
std::string getName()
Get the job&#39;s name.
Definition: WorkflowJob.cpp:74
PilotJob * pilot_job
The pilot job that has expired.
Definition: WorkflowExecutionEvent.h:197
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:139
std::shared_ptr< ComputeService > compute_service
The compute service on which the job has failed.
Definition: WorkflowExecutionEvent.h:131
StandardJob * standard_job
The standard job that has completed.
Definition: WorkflowExecutionEvent.h:93
A "timer went off" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:308
std::shared_ptr< ComputeService > compute_service
The compute service on which the pilot job has started.
Definition: WorkflowExecutionEvent.h:167
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:329
std::string toString() override
Get a textual description of the event.
Definition: WorkflowExecutionEvent.h:101
bool file_registry_service_updated
Whether the file registry service (if any) has been successfully updated.
Definition: WorkflowExecutionEvent.h:244
std::shared_ptr< FileLocation > src
The source location.
Definition: WorkflowExecutionEvent.h:287
std::shared_ptr< FileLocation > src
The source location.
Definition: WorkflowExecutionEvent.h:238
std::shared_ptr< ComputeService > compute_service
The compute service on which the standard job has completed.
Definition: WorkflowExecutionEvent.h:95
WorkflowFile * file
The workflow file that has failed to be copied.
Definition: WorkflowExecutionEvent.h:285
Definition: Alarm.cpp:19
A "pilot job has expired" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:180
std::shared_ptr< FileLocation > dst
The destination location.
Definition: WorkflowExecutionEvent.h:240
PilotJob * pilot_job
The pilot job that has started.
Definition: WorkflowExecutionEvent.h:165