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 
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 
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::WorkunitExecutor::getFilesStoredInScratch
std::set< WorkflowFile * > getFilesStoredInScratch()
Retrieve the list of files stored in scratch space storage.
Definition: WorkunitExecutor.cpp:704
wrench::WorkunitExecutor::getNumCores
unsigned long getNumCores()
Returns the number of cores the service has been allocated.
Definition: WorkunitExecutor.cpp:688
wrench::WorkunitExecutor::workunit
std::shared_ptr< Workunit > workunit
The Workunit this WorkunitExecutor is supposed to perform.
Definition: WorkunitExecutor.h:63
wrench::Workunit
A class to describe a unit of work that's a sub-component of a StandardJob.
Definition: Workunit.h:35
wrench::WorkunitExecutor
An service that performs a WorkUnit.
Definition: WorkunitExecutor.h:40
wrench::WorkunitExecutor::getMemoryUtilization
double getMemoryUtilization()
Returns the RAM the service has been allocated.
Definition: WorkunitExecutor.cpp:696
wrench
Definition: Alarm.cpp:20
wrench::WorkflowTask
A computational task in a Workflow.
Definition: WorkflowTask.h:31
wrench::WorkunitExecutor::getJob
std::shared_ptr< StandardJob > getJob()
Retrieve the job the WorkunitExecutor is working for.
Definition: WorkunitExecutor.cpp:712
wrench::S4U_Daemon::hostname
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:51
wrench::WorkunitExecutor::kill
void kill(bool job_termination)
Kill the worker thread.
Definition: WorkunitExecutor.cpp:130
wrench::Service
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
wrench::SimulationTimestampTaskFailure
A simulation timestamp class for WorkflowTask failure times.
Definition: SimulationTimestampTypes.h:135
wrench::WorkflowFile
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
wrench::WorkunitExecutor::WorkunitExecutor
WorkunitExecutor(std::string hostname, unsigned long num_cores, double ram_utilization, std::string callback_mailbox, std::shared_ptr< Workunit > workunit, std::shared_ptr< StorageService > scratch_space, std::shared_ptr< StandardJob > job, double thread_startup_overhead, bool simulate_computation_as_sleep)
Constructor.
Definition: WorkunitExecutor.cpp:58