WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
WorkunitExecutor.h
1 
11 #ifndef WRENCH_WORKUNITMULTICOREEXECUTOR_H
12 #define WRENCH_WORKUNITMULTICOREEXECUTOR_H
13 
14 
15 #include "wrench/services/Service.h"
16 #include <set>
17 #include "wrench/services/compute/workunit_executor/Workunit.h"
18 
19 namespace wrench {
20 
21  class Simulation;
22  class StorageService;
23  class WorkflowFile;
24  class WorkflowTask;
25  class StorageService;
26  class StandardJob;
27  class WorkerThreadWork;
28  class Workunit;
29  class ComputeThread;
30  class WorkflowJob;
31  class SimulationTimestampTaskFailure;
32 
33  /***********************/
35  /***********************/
36 
40  class WorkunitExecutor : public Service {
41 
42  public:
43 
44  WorkunitExecutor(
45  std::string hostname,
46  unsigned long num_cores,
47  double ram_utilization,
48  std::string callback_mailbox,
49  std::shared_ptr<Workunit> workunit,
50  std::shared_ptr<StorageService> scratch_space,
51  std::shared_ptr<StandardJob> job,
52  double thread_startup_overhead,
53  bool simulate_computation_as_sleep);
54 
55  void kill(bool job_termination);
56 
57  unsigned long getNumCores();
58  std::shared_ptr<StandardJob> getJob();
59  double getMemoryUtilization();
60  std::set<WorkflowFile*> getFilesStoredInScratch();
61 
63  std::shared_ptr<Workunit> workunit;
64 
65  private:
66 
67  bool failure_timestamp_should_be_generated = false;
68  bool task_completion_timestamp_should_be_generated = false;
69  bool terminated_due_job_being_forcefully_terminated = false;
70  bool task_start_timestamp_has_been_inserted = false;
71  bool task_failure_time_stamp_has_already_been_generated = false;
72 
73  SimulationTimestampTaskFailure *foo;
74  int main() override;
75  void cleanup(bool has_returned_from_main, int return_value) override;
76 
77  void performWork(Workunit *work);
78 
79  void runMulticoreComputationForTask(WorkflowTask *task, bool simulate_computation_as_sleep);
80 
81  bool isUseOfScratchSpaceOK();
82  bool areFileLocationsOK(WorkflowFile **offending_file);
83 
84  std::string callback_mailbox;
85  unsigned long num_cores;
86  double ram_utilization;
87  double thread_startup_overhead;
88  bool simulate_computation_as_sleep;
89 
90  std::shared_ptr<StorageService> scratch_space;
91 
92  std::set<WorkflowFile* > files_stored_in_scratch;
93  std::vector<std::shared_ptr<ComputeThread>> compute_threads;
94 
95  // a reference to the job it is a part of (currently required for creating the /tmp directory in scratch space)
96  std::shared_ptr<StandardJob> job;
97 
98  };
99 
100  /***********************/
102  /***********************/
103 
104 };
105 
106 
107 #endif //WRENCH_WORKUNITEXECUTOR_H
wrench
Definition: Alarm.cpp:20