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 
48  enum EventType {
50  UNDEFINED,
52  STANDARD_JOB_COMPLETION,
54  STANDARD_JOB_FAILURE,
56  PILOT_JOB_START,
58  PILOT_JOB_EXPIRATION,
60  FILE_COPY_COMPLETION,
62  FILE_COPY_FAILURE,
63  };
64 
66  WorkflowExecutionEvent::EventType type;
67 
68 
69  /***********************/
71  /***********************/
72  static std::unique_ptr<WorkflowExecutionEvent> waitForNextExecutionEvent(std::string);
73  virtual ~WorkflowExecutionEvent() = default;
74 
75  protected:
76 
82  WorkflowExecutionEvent(EventType type) : type(type) {}
83  /***********************/
85  /***********************/
86 
87  };
88 
89 
93  class StandardJobCompletedEvent : public WorkflowExecutionEvent {
94 
95 
96  private:
97 
98  friend class WorkflowExecutionEvent;
104  StandardJobCompletedEvent(StandardJob *standard_job,
105  ComputeService *compute_service)
106  : WorkflowExecutionEvent(STANDARD_JOB_COMPLETION),
107  standard_job(standard_job), compute_service(compute_service) {}
108  public:
109 
111  StandardJob *standard_job;
113  ComputeService *compute_service;
114  };
115 
119  class StandardJobFailedEvent : public WorkflowExecutionEvent {
120 
121  private:
122 
123  friend class WorkflowExecutionEvent;
124 
131  StandardJobFailedEvent(StandardJob *standard_job,
132  ComputeService *compute_service,
133  std::shared_ptr<FailureCause> failure_cause)
134  : WorkflowExecutionEvent(STANDARD_JOB_FAILURE),
135  standard_job(standard_job),
136  compute_service(compute_service),
137  failure_cause(failure_cause) {}
138 
139  public:
140 
142  StandardJob *standard_job;
144  ComputeService *compute_service;
146  std::shared_ptr<FailureCause> failure_cause;
147  };
148 
149 
153  class PilotJobStartedEvent : public WorkflowExecutionEvent {
154 
155  private:
156 
157  friend class WorkflowExecutionEvent;
158 
164  PilotJobStartedEvent(PilotJob *pilot_job,
165  ComputeService *compute_service)
166  : WorkflowExecutionEvent(PILOT_JOB_START),
167  pilot_job(pilot_job), compute_service(compute_service) {}
168 
169  public:
171  PilotJob *pilot_job;
173  ComputeService *compute_service;
174  };
175 
179  class PilotJobExpiredEvent : public WorkflowExecutionEvent {
180 
181  private:
182 
183  friend class WorkflowExecutionEvent;
189  PilotJobExpiredEvent(PilotJob *pilot_job,
190  ComputeService *compute_service)
191  : WorkflowExecutionEvent(PILOT_JOB_EXPIRATION),
192  pilot_job(pilot_job), compute_service(compute_service) {}
193 
194  public:
195 
197  PilotJob *pilot_job;
199  ComputeService *compute_service;
200  };
201 
205  class FileCopyCompletedEvent : public WorkflowExecutionEvent {
206 
207  private:
208 
209  friend class WorkflowExecutionEvent;
217  FileCopyCompletedEvent(WorkflowFile *file,
218  StorageService *storage_service,
219  FileRegistryService *file_registry_service,
220  bool file_registry_service_updated)
221  : WorkflowExecutionEvent(FILE_COPY_COMPLETION),
222  file(file), storage_service(storage_service),
223  file_registry_service(file_registry_service),
224  file_registry_service_updated(file_registry_service_updated) {}
225 
226  public:
228  WorkflowFile *file;
230  StorageService *storage_service;
232  FileRegistryService *file_registry_service;
235  };
236 
237 
241  class FileCopyFailedEvent : public WorkflowExecutionEvent {
242 
243  private:
244 
245  friend class WorkflowExecutionEvent;
252  FileCopyFailedEvent(WorkflowFile *file,
253  StorageService *storage_service,
254  std::shared_ptr<FailureCause> failure_cause
255  )
256  : WorkflowExecutionEvent(FILE_COPY_FAILURE),
257  file(file), storage_service(storage_service),
258  failure_cause(failure_cause) {}
259 
260  public:
261 
263  WorkflowFile *file;
265  StorageService *storage_service;
267  std::shared_ptr<FailureCause> failure_cause;
268 
269  };
270 
271 };
272 
273 /***********************/
275 /***********************/
276 
277 
278 
279 #endif //WRENCH_WORKFLOWEXECUTIONEVENT_H
A "pilot job has started" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:153
A "standard job has failed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:119
std::shared_ptr< FailureCause > failure_cause
The cause of the failure.
Definition: WorkflowExecutionEvent.h:146
A "file copy has failed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:241
StorageService * storage_service
The storage service to which the file has been copied.
Definition: WorkflowExecutionEvent.h:230
WorkflowFile * file
The workflow file that has failed to be copied.
Definition: WorkflowExecutionEvent.h:263
StandardJob * standard_job
The standard job that has failed.
Definition: WorkflowExecutionEvent.h:142
bool file_registry_service_updated
Whether the file registry service (if any) has been successfully updated.
Definition: WorkflowExecutionEvent.h:234
A "pilot job has expired" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:179
A "file copy has completed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:205
ComputeService * compute_service
The compute service on which the pilot job has expired.
Definition: WorkflowExecutionEvent.h:199
FileRegistryService * file_registry_service
The file registry service that was supposed to be updated (or nullptr if none)
Definition: WorkflowExecutionEvent.h:232
ComputeService * compute_service
The compute service on which the job has failed.
Definition: WorkflowExecutionEvent.h:144
StandardJob * standard_job
The standard job that has completed.
Definition: WorkflowExecutionEvent.h:111
StorageService * storage_service
The storage service on which it was supposed to be copied.
Definition: WorkflowExecutionEvent.h:265
ComputeService * compute_service
The compute service on which the standard job has completed.
Definition: WorkflowExecutionEvent.h:113
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:228
std::shared_ptr< FailureCause > failure_cause
The cause of the failure.
Definition: WorkflowExecutionEvent.h:267
A "standard job has completed" WorkflowExecutionEvent.
Definition: WorkflowExecutionEvent.h:93
PilotJob * pilot_job
The pilot job that has started.
Definition: WorkflowExecutionEvent.h:171
ComputeService * compute_service
The compute service on which the pilot job has started.
Definition: WorkflowExecutionEvent.h:173
Definition: TerminalOutput.cpp:15