WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
ComputeService.h
1 
10 #ifndef SIMULATION_COMPUTESERVICE_H
11 #define SIMULATION_COMPUTESERVICE_H
12 
13 #include <map>
14 
15 #include <iostream>
16 #include <cfloat>
17 #include <climits>
18 
19 #include "wrench/services/Service.h"
20 #include "wrench/workflow/job/WorkflowJob.h"
21 #include "wrench/workflow/job/StandardJob.h"
22 #include "wrench/workflow/job/PilotJob.h"
23 
24 namespace wrench {
25 
26  class Simulation;
27 
28  class StorageService;
29 
33  class ComputeService : public Service {
34 
35  /***********************/
37  /***********************/
38 
39  friend class StandardJobExecutorTest;
40  friend class Simulation;
41 
42  /***********************/
44  /***********************/
45 
46 
47  public:
48 
52  static constexpr unsigned long ALL_CORES = ULONG_MAX;
53 
57  static constexpr double ALL_RAM = DBL_MAX;
58 
59  /***********************/
61  /***********************/
62 
63  virtual ~ComputeService() {}
64 
65  void stop() override;
66 
67 // void submitJob(WorkflowJob *job, const std::map<std::string, std::string>& = {});
68 
69  void terminateJob(std::shared_ptr<WorkflowJob> job);
70 
71  bool supportsStandardJobs();
72 
73  bool supportsPilotJobs();
74 
75  bool hasScratch();
76 
77  unsigned long getNumHosts();
78 
79  std::vector<std::string> getHosts();
80 
81  std::map<std::string, unsigned long> getPerHostNumCores();
82 
83  unsigned long getTotalNumCores();
84 
85  std::map<std::string, unsigned long> getPerHostNumIdleCores();
86 
87  virtual unsigned long getTotalNumIdleCores();
88 
89  virtual bool isThereAtLeastOneHostWithIdleResources(unsigned long num_cores, double ram);
90 
91  std::map<std::string, double> getMemoryCapacity();
92 
93  std::map<std::string, double> getPerHostAvailableMemoryCapacity();
94 
95  std::map<std::string, double> getCoreFlopRate();
96 
97  double getTTL();
98 
99  double getTotalScratchSpaceSize();
100 
101  double getFreeScratchSpaceSize();
102 
103 
104  /***********************/
106  /***********************/
107 
108  /***********************/
110  /***********************/
111 
118  virtual void
119  submitStandardJob(std::shared_ptr<StandardJob> job, const std::map<std::string, std::string> &service_specific_arguments) = 0;
120 
127  virtual void submitPilotJob(std::shared_ptr<PilotJob> job, const std::map<std::string, std::string> &service_specific_arguments) = 0;
128 
133  virtual void terminateStandardJob(std::shared_ptr<StandardJob> job) = 0;
134 
139  virtual void terminatePilotJob(std::shared_ptr<PilotJob> job) = 0;
140 
145  std::shared_ptr<StorageService> getScratch();
146 
147 
148  ComputeService(const std::string &hostname,
149  std::string service_name,
150  std::string mailbox_name_prefix,
151  std::string scratch_space_mount_point);
152 
153  protected:
154 
155  friend class JobManager;
156 
157  void submitJob(std::shared_ptr<WorkflowJob> job, const std::map<std::string, std::string>& = {});
158 
159  ComputeService(const std::string &hostname,
160  std::string service_name,
161  std::string mailbox_name_prefix,
162  std::shared_ptr<StorageService> scratch_space);
163 
165  std::shared_ptr<StorageService> scratch_space_storage_service;
166 
167  /***********************/
169  /***********************/
170 
171  /***********************/
173  /***********************/
174 
175  std::shared_ptr<StorageService> getScratchSharedPtr();
176 
177  /***********************/
179  /***********************/
180 
181  private:
182 
183 
184  std::shared_ptr<StorageService> scratch_space_storage_service_shared_ptr;
185 
186  std::map<std::string, std::map<std::string, double>> getServiceResourceInformation();
187 
188  };
189 
190 
191 };
192 
193 #endif //SIMULATION_COMPUTESERVICE_H
wrench::ComputeService
The compute service base class.
Definition: ComputeService.h:33
wrench
Definition: Alarm.cpp:20
wrench::ComputeService::ALL_CORES
static constexpr unsigned long ALL_CORES
A convenient constant to mean "use all cores of a physical host" whenever a number of cores is needed...
Definition: ComputeService.h:52
wrench::Simulation
A class that provides basic simulation methods. Once the simulation object has been explicitly or imp...
Definition: Simulation.h:46
wrench::ComputeService::ALL_RAM
static constexpr double ALL_RAM
A convenient constant to mean "use all ram of a physical host" whenever a ram capacity is needed when...
Definition: ComputeService.h:57
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