FailureCause.h
1 
10 #ifndef WRENCH_STANDARDJOBFAILURECAUSE_H
11 #define WRENCH_STANDARDJOBFAILURECAUSE_H
12 
13 
14 #include <set>
15 #include <string>
16 
17 namespace wrench {
18 
19  class Service;
20  class WorkflowFile;
21  class StorageService;
22  class ComputeService;
23  class WorkflowJob;
24 
25  /***********************/
27  /***********************/
28 
29 
35  class FailureCause {
36 
37  public:
38 
40  enum CauseType {
79 
80  };
81 
82  explicit FailureCause(CauseType cause);
83 
84  /***********************/
86  /***********************/
87  virtual ~FailureCause() = default;
88  /***********************/
90  /***********************/
91 
92 
98  virtual std::string toString() = 0;
99 
101 
102  private:
103  CauseType cause;
104  };
105 
106 
111 
112  public:
113  /***********************/
115  /***********************/
117  /***********************/
119  /***********************/
120 
121  WorkflowFile *getFile();
122  std::string toString();
123 
124  private:
125  WorkflowFile *file;
126  };
127 
128 
132  class NoScratchSpace : public FailureCause {
133 
134  public:
135  /***********************/
137  /***********************/
138  NoScratchSpace(std::string error);
139  /***********************/
141  /***********************/
142 
143  std::string toString();
144  private:
145  std::string error;
146  };
147 
151  class FileNotFound : public FailureCause {
152 
153  public:
154  /***********************/
156  /***********************/
157  FileNotFound(WorkflowFile *file, StorageService *storage_service);
158  /***********************/
160  /***********************/
161 
162  WorkflowFile *getFile();
163  StorageService *getStorageService();
164  std::string toString();
165 
166 
167  private:
168  WorkflowFile *file;
169  StorageService *storage_service;
170  };
171 
176 
177  public:
178  /***********************/
180  /***********************/
182  /***********************/
184  /***********************/
185 
186  WorkflowFile *getFile();
187  StorageService *getStorageService();
188  std::string toString();
189 
190 
191  private:
192  WorkflowFile *file;
193  StorageService *storage_service;
194  };
195 
196 // /**
197 // * @brief A "file is already there" failure cause
198 // */
199 // class StorageServiceFileAlreadyThere : public FailureCause {
200 //
201 // public:
202 // /***********************/
203 // /** \cond INTERNAL */
204 // /***********************/
205 // StorageServiceFileAlreadyThere(WorkflowFile *file, StorageService *storage_service);
206 // /***********************/
207 // /** \endcond */
208 // /***********************/
209 //
210 // WorkflowFile *getFile();
211 // StorageService *getStorageService();
212 // std::string toString();
213 //
214 //
215 // private:
216 // WorkflowFile *file;
217 // StorageService *storage_service;
218 // };
219 
224 
225  public:
226  /***********************/
228  /***********************/
229  FileAlreadyBeingCopied(WorkflowFile *file, StorageService *dst, std::string dst_partition);
230  /***********************/
232  /***********************/
233 
234  WorkflowFile *getFile();
235  StorageService *getStorageService();
236  std::string getPartition();
237  std::string toString();
238 
239  private:
240  WorkflowFile *file;
241  StorageService *storage_service;
242  std::string dst_partition;
243  };
244 
248  class
249  ServiceIsDown : public FailureCause {
250  public:
251  /***********************/
253  /***********************/
254  explicit ServiceIsDown(Service *service);
255  /***********************/
257  /***********************/
258 
259  Service *getService();
260  std::string toString() override;
261 
262  private:
263  Service *service;
264  };
265 
270  public:
271  /***********************/
273  /***********************/
274  JobTypeNotSupported(WorkflowJob *job, ComputeService *compute_service);
275  /***********************/
277  /***********************/
278 
279  WorkflowJob *getJob();
280  ComputeService *getComputeService();
281  std::string toString();
282 
283  private:
284  WorkflowJob *job;
285  ComputeService *compute_service;
286  };
287 
292  public:
293  /***********************/
295  /***********************/
296  FunctionalityNotAvailable(Service *service, std::string functionality_name);
297  /***********************/
299  /***********************/
300 
301  Service *getService();
302  std::string getFunctionalityName();
303  std::string toString();
304 
305  private:
306  Service *service;
307  std::string functionality_name;
308  };
309 
310 
315  public:
316  /***********************/
318  /***********************/
319  NotEnoughResources(WorkflowJob *job, ComputeService *compute_service);
320  /***********************/
322  /***********************/
323 
324  WorkflowJob *getJob();
325  ComputeService *getComputeService();
326  std::string toString();
327 
328  private:
329  WorkflowJob *job;
330  ComputeService *compute_service;
331  };
332 
336  class JobKilled : public FailureCause {
337  public:
338  /***********************/
340  /***********************/
341  JobKilled(WorkflowJob *job, ComputeService *compute_service);
342  /***********************/
344  /***********************/
345 
346  WorkflowJob *getJob();
347  ComputeService *getComputeService();
348  std::string toString();
349 
350  private:
351  WorkflowJob *job;
352  ComputeService *compute_service;
353  };
354 
355 
359  class NetworkError : public FailureCause {
360  public:
365  SENDING,
366  RECEIVING
367  };
368 
371  enum ErrorType {
372  TIMEOUT,
373  FAILURE
374  };
375 
376  /***********************/
378  /***********************/
380  /***********************/
382  /***********************/
383 
384  std::string toString();
385  bool whileReceiving();
386  bool whileSending();
387  bool isTimeout();
388  std::string getMailbox();
389 
390  private:
391  NetworkError::OperationType operation_type;
392  NetworkError::ErrorType error_type;
393  bool while_sending = false;
394  std::string mailbox = "";
395  };
396 
400  class HostError : public FailureCause {
401  public:
402 
403  /***********************/
405  /***********************/
406  HostError(std::string hostname);
407  /***********************/
409  /***********************/
410 
411  std::string toString();
412 
413  private:
414  std::string hostname;
415  };
416 
417 
422  public:
423  /***********************/
425  /***********************/
427  /***********************/
429  /***********************/
430 
431  WorkflowJob *getJob();
432  std::string toString();
433 
434  private:
435  WorkflowJob *job;
436  };
437 
442  public:
443  /***********************/
445  /***********************/
447  /***********************/
449  /***********************/
450 
451  WorkflowJob *getJob();
452  std::string toString();
453 
454  private:
455  WorkflowJob *job;
456  };
457 
462  public:
463  /***********************/
465  /***********************/
467  /***********************/
469  /***********************/
470 
471  std::string toString();
472 
473  private:
474  };
475 
479  class FatalFailure : public FailureCause {
480  public:
481  /***********************/
483  /***********************/
484  FatalFailure();
485  /***********************/
487  /***********************/
488 
489  std::string toString();
490 
491  private:
492  };
493 
494 
498  class JobTimeout : public FailureCause {
499  public:
500  /***********************/
502  /***********************/
503  JobTimeout(WorkflowJob *job);
504  /***********************/
506  /***********************/
507 
508  WorkflowJob *getJob();
509  std::string toString();
510 
511  private:
512  WorkflowJob *job;
513  };
514 
515 
516  /***********************/
518  /***********************/
519 };
520 
521 
522 #endif //WRENCH_STANDARDJOBFAILURECAUSE_H
A Job has been killed (likely because the service performing it was terminated)
Definition: FailureCause.h:66
FailureCause(CauseType cause)
Constructor.
Definition: FailureCause.cpp:24
A "file is already there" failure cause.
Definition: FailureCause.h:223
CauseType getCauseType()
Retrieve the type of the failure cause.
Definition: FailureCause.cpp:32
The file to be written is already there.
Definition: FailureCause.h:50
A job was terminated due to a timeout.
Definition: FailureCause.h:76
The storage service does not have enough space to support the requested operation.
Definition: FailureCause.h:54
A "job has times out" failure cause.
Definition: FailureCause.h:498
A "file cannot be found anywhere" failure cause.
Definition: FailureCause.h:110
A "file was not found" failure cause.
Definition: FailureCause.h:151
A service that can be added to the simulation and that can be used by a WMS when executing a workflow...
Definition: Service.h:26
A top-level class to describe all simulation-valid failures that can occur during workflow execution ...
Definition: FailureCause.h:35
A "job cannot be forgotten" failure cause.
Definition: FailureCause.h:441
There was a network error, or an endpoint was down.
Definition: FailureCause.h:62
A "compute service does not support requested job type" failure cause.
Definition: FailureCause.h:269
Abstraction of a job used for executing tasks in a Workflow.
Definition: WorkflowJob.h:31
A functionality is not available.
Definition: FailureCause.h:74
A "no scratch space" failure cause.
Definition: FailureCause.h:132
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
No Scratch Space is available.
Definition: FailureCause.h:46
The file is already being copied there.
Definition: FailureCause.h:52
The host went down (while computing, while sleeping)
Definition: FailureCause.h:78
ErrorType
Enumerated type to describe the type of the network error.
Definition: FailureCause.h:371
A "service is down" failure cause.
Definition: FailureCause.h:248
The job cannot be forgotten because it is not completed.
Definition: FailureCause.h:70
The compute service does not support this job type.
Definition: FailureCause.h:58
A "job has been killed" failure cause.
Definition: FailureCause.h:336
The compute service base class.
Definition: ComputeService.h:35
A compute thread has died.
Definition: FailureCause.h:72
A "job cannot be terminated" failure cause.
Definition: FailureCause.h:421
The job cannot be terminated because it is neither pending nor running.
Definition: FailureCause.h:68
The service cannot be used because it is down (likely it was terminated)
Definition: FailureCause.h:56
CauseType
Types of failure causes.
Definition: FailureCause.h:40
A "network error (or endpoint is down)" failure cause.
Definition: FailureCause.h:359
Unknown cause.
Definition: FailureCause.h:42
A "compute thread has died" failure cause.
Definition: FailureCause.h:461
The file was not found where it was supposed to be found.
Definition: FailureCause.h:48
An "Unknown" failure cause (should not happen)
Definition: FailureCause.h:479
The compute service cannot run the job (ever) due to insufficient resources (cores and/or ram) ...
Definition: FailureCause.h:60
A "requested functionality is not available on that service" failure cause.
Definition: FailureCause.h:291
There was a network timeout (for a "with timeout" network operation)
Definition: FailureCause.h:64
A "host error" failure cause.
Definition: FailureCause.h:400
virtual std::string toString()=0
Return an error message that describes the failure cause (to be overridden)
The storage service base class.
Definition: StorageService.h:35
A "not enough space on storage service" failure cause.
Definition: FailureCause.h:175
OperationType
Enumerated type to describe whether the network error occured while sending or receiving.
Definition: FailureCause.h:364
A "compute service doesn&#39;t have enough cores" failure cause.
Definition: FailureCause.h:314
Definition: TerminalOutput.cpp:15
The file cannot be found anywhere.
Definition: FailureCause.h:44