11 #ifndef WRENCH_STANDARDJOB_H
12 #define WRENCH_STANDARDJOB_H
18 #include <wrench/workflow/Workflow.h>
19 #include <wrench/workflow/WorkflowTask.h>
20 #include <wrench/data_file/DataFile.h>
24 #include "wrench/services/storage/storage_helpers/FileLocation.h"
40 class StandardJob :
public Job,
public std::enable_shared_from_this<StandardJob> {
60 std::vector<std::shared_ptr<WorkflowTask>> getTasks();
62 unsigned long getMinimumRequiredNumCores()
const;
64 unsigned long getMinimumRequiredMemory()
const;
66 unsigned long getNumCompletedTasks()
const;
68 unsigned long getNumTasks()
const;
70 StandardJob::State getState();
74 std::map<std::shared_ptr<DataFile>, std::vector<std::shared_ptr<FileLocation>>> getFileLocations();
78 std::vector<std::shared_ptr<WorkflowTask>> tasks;
84 std::map<std::shared_ptr<DataFile>, std::vector<std::shared_ptr<FileLocation>>> file_locations;
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;
97 std::shared_ptr<StandardJob> getSharedPtr() {
return this->shared_from_this(); }
107 double getPreJobOverheadInSeconds();
108 void setPreJobOverheadInSeconds(
double overhead);
109 double getPostJobOverheadInSeconds();
110 void setPostJobOverheadInSeconds(
double overhead);
115 friend class BareMetalComputeService;
116 friend class JobManager;
117 friend class ExecutionEvent;
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);
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);
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);
143 double pre_overhead = 0.0;
144 double post_overhead = 0.0;
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;
164 #endif //WRENCH_MULTITASKJOB_H