WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
StandardJob.h
1 
11 #ifndef WRENCH_STANDARDJOB_H
12 #define WRENCH_STANDARDJOB_H
13 
14 
15 #include <map>
16 #include <set>
17 #include <vector>
18 #include <wrench/workflow/Workflow.h>
19 #include <wrench/workflow/WorkflowTask.h>
20 #include <wrench/data_file/DataFile.h>
21 
22 #include "Job.h"
23 
24 #include "wrench/services/storage/storage_helpers/FileLocation.h"
25 
26 namespace wrench {
27 
28  /***********************/
30  /***********************/
31 
32  class DataFile;
33  class WorkflowTask;
34  class Action;
35 
40  class StandardJob : public Job, public std::enable_shared_from_this<StandardJob> {
41 
42  public:
43 
45  enum State {
58  };
59 
60  std::vector<std::shared_ptr<WorkflowTask>> getTasks();
61 
62  unsigned long getMinimumRequiredNumCores() const;
63 
64  unsigned long getMinimumRequiredMemory() const;
65 
66  unsigned long getNumCompletedTasks() const;
67 
68  unsigned long getNumTasks() const;
69 
71 
72  bool usesScratch();
73 
74  std::map<std::shared_ptr<DataFile>, std::vector<std::shared_ptr<FileLocation>>> getFileLocations();
75 
76 
78  std::vector<std::shared_ptr<WorkflowTask>> tasks;
79 
81  double total_flops;
82 
84  std::map<std::shared_ptr<DataFile>, std::vector<std::shared_ptr<FileLocation>>> file_locations;
85 
87  std::vector<std::tuple<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation> >> pre_file_copies;
89  std::vector<std::tuple<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation> >> post_file_copies;
91  std::vector<std::tuple<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation> >> cleanup_file_deletions;
92 
97  std::shared_ptr<StandardJob> getSharedPtr() { return this->shared_from_this(); }
98 
99  /***********************/
101  /***********************/
102 
103  /***********************/
105  /***********************/
106 
108  void setPreJobOverheadInSeconds(double overhead);
110  void setPostJobOverheadInSeconds(double overhead);
111 
112 
113  private:
114 
115  friend class BareMetalComputeService;
116  friend class JobManager;
117  friend class ExecutionEvent;
118 
119  StandardJob(std::shared_ptr<JobManager> job_manager,
120  std::vector<std::shared_ptr<WorkflowTask>> tasks, std::map<std::shared_ptr<DataFile>, std::vector<std::shared_ptr<FileLocation>>> &file_locations,
121  std::vector<std::tuple<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation>>> &pre_file_copies,
122  std::vector<std::tuple<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation>>> &post_file_copies,
123  std::vector<std::tuple<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation> >> &cleanup_file_deletions);
124 
125  void createUnderlyingCompoundJob(const std::shared_ptr<ComputeService>& compute_service);
126  void processCompoundJobOutcome(std::map<std::shared_ptr<WorkflowTask>, WorkflowTask::State> &state_changes,
127  std::set<std::shared_ptr<WorkflowTask>> &failure_count_increments,
128  std::shared_ptr<FailureCause> &job_failure_cause,
129  Simulation *simulation);
130  void applyTaskUpdates(std::map<std::shared_ptr<WorkflowTask>, WorkflowTask::State> &state_changes,
131  std::set<std::shared_ptr<WorkflowTask>> &failure_count_increments);
132 
133  void analyzeActions(std::vector<std::shared_ptr<Action>> actions,
134  bool *at_least_one_failed,
135  bool *at_least_one_killed,
136  std::shared_ptr<FailureCause> *failure_cause,
137  double *earliest_start_date,
138  double *latest_end_date,
139  double *earliest_failure_date);
140 
141 
142  State state;
143  double pre_overhead = 0.0;
144  double post_overhead = 0.0;
145 
146  std::shared_ptr<CompoundJob> compound_job;
147  std::shared_ptr<Action> pre_overhead_action = nullptr;
148  std::shared_ptr<Action> post_overhead_action = nullptr;
149  std::vector<std::shared_ptr<Action>> pre_file_copy_actions;
150  std::map<std::shared_ptr<WorkflowTask>, std::vector<std::shared_ptr<Action>>> task_file_read_actions;
151  std::map<std::shared_ptr<WorkflowTask>, std::shared_ptr<Action>> task_compute_actions;
152  std::map<std::shared_ptr<WorkflowTask>, std::vector<std::shared_ptr<Action>>> task_file_write_actions;
153  std::vector<std::shared_ptr<Action>> post_file_copy_actions;
154  std::vector<std::shared_ptr<Action>> cleanup_actions;
155  std::shared_ptr<Action> scratch_cleanup = nullptr;
156  };
157 
158  /***********************/
160  /***********************/
161 
162 };
163 
164 #endif //WRENCH_MULTITASKJOB_H
wrench::StandardJob::getFileLocations
std::map< std::shared_ptr< DataFile >, std::vector< std::shared_ptr< FileLocation > > > getFileLocations()
Get the file location map for the job.
Definition: StandardJob.cpp:143
wrench::WorkflowTask::State
State
Task states.
Definition: WorkflowTask.h:72
wrench::Job
Abstraction of a job used for executing tasks in a Workflow.
Definition: Job.h:34
wrench::StandardJob::NOT_SUBMITTED
@ NOT_SUBMITTED
Not submitted yet.
Definition: StandardJob.h:47
wrench::StandardJob::getNumTasks
unsigned long getNumTasks() const
Get the number of tasks in the job.
Definition: StandardJob.cpp:110
wrench::StandardJob::getMinimumRequiredNumCores
unsigned long getMinimumRequiredNumCores() const
Returns the minimum number of cores required to run the job (i.e., at least one task in the job canno...
Definition: StandardJob.cpp:83
wrench::JobManager
A helper daemon (co-located with and explicitly started by an execution controller),...
Definition: JobManager.h:56
wrench::StandardJob::usesScratch
bool usesScratch()
Determines whether the job's spec uses scratch space.
Definition: StandardJob.cpp:851
wrench::StandardJob::TERMINATED
@ TERMINATED
Terminated by submitter.
Definition: StandardJob.h:57
wrench::StandardJob::setPostJobOverheadInSeconds
void setPostJobOverheadInSeconds(double overhead)
sets the job's post-overhead
Definition: StandardJob.cpp:183
wrench::StandardJob::post_file_copies
std::vector< std::tuple< std::shared_ptr< DataFile >, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation > > > post_file_copies
The ordered file copy operations to perform after computational tasks.
Definition: StandardJob.h:89
wrench::StandardJob::COMPLETED
@ COMPLETED
Completed successfully.
Definition: StandardJob.h:53
wrench::StandardJob::file_locations
std::map< std::shared_ptr< DataFile >, std::vector< std::shared_ptr< FileLocation > > > file_locations
The file locations that tasks should read/write files from/to. Each file is given a list of locations...
Definition: StandardJob.h:84
wrench::StandardJob
A standard (i.e., non-pilot) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: StandardJob.h:40
wrench::BareMetalComputeService
A compute service that manages a set of multi-core compute hosts and provides access to their resourc...
Definition: BareMetalComputeService.h:45
wrench::StandardJob::getTasks
std::vector< std::shared_ptr< WorkflowTask > > getTasks()
Get the workflow tasks in the job.
Definition: StandardJob.cpp:134
wrench
Definition: Action.cpp:28
wrench::StandardJob::FAILED
@ FAILED
Failed.
Definition: StandardJob.h:55
wrench::StandardJob::setPreJobOverheadInSeconds
void setPreJobOverheadInSeconds(double overhead)
sets the job's pre-overhead
Definition: StandardJob.cpp:175
wrench::Job::job_manager
std::shared_ptr< JobManager > job_manager
The Job Manager in charge of this job.
Definition: Job.h:86
wrench::ExecutionEvent
A class to represent the various execution events that are relevant to the execution of a workflow.
Definition: ExecutionEvent.h:26
wrench::StandardJob::cleanup_file_deletions
std::vector< std::tuple< std::shared_ptr< DataFile >, std::shared_ptr< FileLocation > > > cleanup_file_deletions
The ordered file deletion operations to perform at the end.
Definition: StandardJob.h:91
wrench::StandardJob::getPostJobOverheadInSeconds
double getPostJobOverheadInSeconds()
get the job's post-overhead
Definition: StandardJob.cpp:167
wrench::StandardJob::RUNNING
@ RUNNING
Running.
Definition: StandardJob.h:51
wrench::StandardJob::getNumCompletedTasks
unsigned long getNumCompletedTasks() const
Get the number of completed tasks in the job.
Definition: StandardJob.cpp:119
wrench::StandardJob::getSharedPtr
std::shared_ptr< StandardJob > getSharedPtr()
Get the shared pointer for this object.
Definition: StandardJob.h:97
wrench::StandardJob::total_flops
double total_flops
The job's total computational cost (in flops)
Definition: StandardJob.h:81
wrench::StandardJob::pre_file_copies
std::vector< std::tuple< std::shared_ptr< DataFile >, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation > > > pre_file_copies
The ordered file copy operations to perform before computational tasks.
Definition: StandardJob.h:87
wrench::Simulation
A class that provides basic simulation methods. Once the simulation object has been explicitly or imp...
Definition: Simulation.h:48
wrench::StandardJob::getState
StandardJob::State getState()
Get the state of the standard job.
Definition: StandardJob.cpp:151
wrench::StandardJob::getPreJobOverheadInSeconds
double getPreJobOverheadInSeconds()
get the job's pre-overhead
Definition: StandardJob.cpp:159
wrench::StandardJob::State
State
Standard job states.
Definition: StandardJob.h:45
wrench::StandardJob::PENDING
@ PENDING
Submitted but not running yet.
Definition: StandardJob.h:49
wrench::StandardJob::tasks
std::vector< std::shared_ptr< WorkflowTask > > tasks
The job's computational tasks.
Definition: StandardJob.h:78
wrench::StandardJob::getMinimumRequiredMemory
unsigned long getMinimumRequiredMemory() const
Returns the minimum RAM capacity required to run the job (i.e., at least one task in the job cannot r...
Definition: StandardJob.cpp:96