WMS.h
1 
10 #ifndef WRENCH_WMS_H
11 #define WRENCH_WMS_H
12 
13 #include <wrench/managers/EnergyMeter.h>
14 #include "wrench/simgrid_S4U_util/S4U_Daemon.h"
15 #include "wrench/services/Service.h"
16 #include "wrench/wms/DynamicOptimization.h"
17 #include "wrench/wms/StaticOptimization.h"
18 #include "wrench/wms/scheduler/PilotJobScheduler.h"
19 #include "wrench/wms/scheduler/StandardJobScheduler.h"
20 #include "wrench/workflow/Workflow.h"
21 
22 namespace wrench {
23 
24  class Simulation;
25  class ComputeService;
26  class StorageService;
27  class NetworkProximityService;
28  class FileRegistryService;
29 
33  class WMS : public Service {
34 
35  public:
36  void addWorkflow(Workflow *workflow, double start_time = 0);
40 
41  void addStaticOptimization(std::unique_ptr<StaticOptimization>);
42 
43  void addDynamicOptimization(std::unique_ptr<DynamicOptimization>);
44 
45 
46  protected:
47 
48  /***********************/
50  /***********************/
51 
52  WMS(std::unique_ptr<StandardJobScheduler> standard_job_scheduler,
53  std::unique_ptr<PilotJobScheduler> pilot_job_scheduler,
54  const std::set<ComputeService *> &compute_services,
55  const std::set<StorageService *> &storage_services,
56  const std::set<NetworkProximityService *> &network_proximity_services,
57  FileRegistryService *file_registry_service,
58  const std::string &hostname,
59  const std::string suffix);
60 
61 
62  void checkDeferredStart();
63 
64  std::shared_ptr<JobManager> createJobManager();
65  std::shared_ptr<DataMovementManager> createDataMovementManager();
66  std::shared_ptr<EnergyMeter> createEnergyMeter(const std::map<std::string, double> &measurement_periods);
67  std::shared_ptr<EnergyMeter> createEnergyMeter(const std::vector<std::string> &hostnames, double measurement_period);
68 
69  void runDynamicOptimizations();
70 
71  void runStaticOptimizations();
72 
73  std::set<ComputeService *> getAvailableComputeServices();
74  std::set<StorageService *> getAvailableStorageServices();
75  std::set<NetworkProximityService *> getAvailableNetworkProximityServices();
76  FileRegistryService * getAvailableFileRegistryService();
77 
78  void waitForAndProcessNextEvent();
79 
80  virtual void processEventStandardJobCompletion(std::unique_ptr<StandardJobCompletedEvent>);
81 
82  virtual void processEventStandardJobFailure(std::unique_ptr<StandardJobFailedEvent>);
83 
84  virtual void processEventPilotJobStart(std::unique_ptr<PilotJobStartedEvent>);
85 
86  virtual void processEventPilotJobExpiration(std::unique_ptr<PilotJobExpiredEvent>);
87 
88  virtual void processEventFileCopyCompletion(std::unique_ptr<FileCopyCompletedEvent>);
89 
90  virtual void processEventFileCopyFailure(std::unique_ptr<FileCopyFailedEvent>);
91 
92  /***********************/
94  /***********************/
95 
96  /***********************/
98  /***********************/
99 
100  private:
101  friend class Simulation;
102  friend class DataMovementManager;
103  friend class JobManager;
104 
106  Workflow *workflow;
108  double start_time;
110  std::set<ComputeService *> compute_services;
112  std::set<StorageService *> storage_services;
114  std::set<NetworkProximityService *> network_proximity_services;
116  FileRegistryService * file_registry_service;
117 
119  std::unique_ptr<StandardJobScheduler> standard_job_scheduler;
121  std::unique_ptr<PilotJobScheduler> pilot_job_scheduler;
122 
124  std::vector<std::unique_ptr<DynamicOptimization>> dynamic_optimizations;
126  std::vector<std::unique_ptr<StaticOptimization>> static_optimizations;
127 
128  /***********************/
130  /***********************/
131 
132  private:
133  virtual int main() = 0;
134 
135  };
136 };
137 
138 
139 #endif //WRENCH_WMS_H
PilotJobScheduler * getPilotJobScheduler()
Get the WMS&#39;s pilot scheduler.
Definition: WMS.cpp:361
A (mostly virtual) base class for implementing PilotJob scheduling algorithms to be used by a WMS...
Definition: PilotJobScheduler.h:26
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
A workflow (to be executed by a WMS)
Definition: Workflow.h:30
StandardJobScheduler * getStandardJobScheduler()
Get the WMS&#39;s pilot scheduler.
Definition: WMS.cpp:369
void addWorkflow(Workflow *workflow, double start_time=0)
Assign a workflow to the WMS.
Definition: WMS.cpp:274
A class that provides basic simulation methods.
Definition: Simulation.h:34
void addDynamicOptimization(std::unique_ptr< DynamicOptimization >)
Add a dynamic optimization to the list of optimizations. Optimizations are executed in order of inser...
Definition: WMS.cpp:63
A file registry service (a.k.a. replica catalog) that holds a database of which files are available a...
Definition: FileRegistryService.h:33
A (mostly virtual) base class for implementing StandardJob scheduling algorithms to be used by a WMS...
Definition: StandardJobScheduler.h:31
Workflow * getWorkflow()
Get the workflow that was assigned to the WMS.
Definition: WMS.cpp:299
A workflow management system (WMS)
Definition: WMS.h:33
void addStaticOptimization(std::unique_ptr< StaticOptimization >)
Add a static optimization to the list of optimizations. Optimizations are executed in order of insert...
Definition: WMS.cpp:73
Definition: TerminalOutput.cpp:15