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 
70 
72 
73  std::set<ComputeService *> getAvailableComputeServices();
74  std::set<StorageService *> getAvailableStorageServices();
75  std::set<NetworkProximityService *> getAvailableNetworkProximityServices();
77 
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
void runDynamicOptimizations()
Perform dynamic optimizations. Optimizations are executed in order of insertion.
Definition: WMS.cpp:113
FileRegistryService * getAvailableFileRegistryService()
Obtain the file registry service available to the WMS.
Definition: WMS.cpp:160
void checkDeferredStart()
Check whether the WMS has a deferred start simulation time (likely the first call in the main() routi...
Definition: WMS.cpp:83
virtual void processEventFileCopyFailure(std::unique_ptr< FileCopyFailedEvent >)
Process a WorkflowExecutionEvent::FILE_COPY_FAILURE event.
Definition: WMS.cpp:263
virtual void processEventStandardJobFailure(std::unique_ptr< StandardJobFailedEvent >)
Process a WorkflowExecutionEvent::STANDARD_JOB_FAILURE event.
Definition: WMS.cpp:227
WMS(std::unique_ptr< StandardJobScheduler > standard_job_scheduler, std::unique_ptr< PilotJobScheduler > pilot_job_scheduler, const std::set< ComputeService *> &compute_services, const std::set< StorageService *> &storage_services, const std::set< NetworkProximityService *> &network_proximity_services, FileRegistryService *file_registry_service, const std::string &hostname, const std::string suffix)
Constructor: a WMS with a workflow instance, a scheduler implementation, and a list of compute servic...
Definition: WMS.cpp:38
std::shared_ptr< DataMovementManager > createDataMovementManager()
Instantiate and start a data movement manager.
Definition: WMS.cpp:319
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
std::shared_ptr< EnergyMeter > createEnergyMeter(const std::map< std::string, double > &measurement_periods)
Instantiate and start an energy meter.
Definition: WMS.cpp:334
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
virtual void processEventPilotJobStart(std::unique_ptr< PilotJobStartedEvent >)
Process a WorkflowExecutionEvent::PILOT_JOB_START event.
Definition: WMS.cpp:236
A helper daemon (co-located with a WMS) that handles data movement operations.
Definition: DataMovementManager.h:31
A file registry service (a.k.a. replica catalog) that holds a database of which files are available a...
Definition: FileRegistryService.h:33
virtual void processEventFileCopyCompletion(std::unique_ptr< FileCopyCompletedEvent >)
Process a WorkflowExecutionEvent::FILE_COPY_COMPLETION event.
Definition: WMS.cpp:254
std::set< StorageService * > getAvailableStorageServices()
Obtain the list of storage services available to the WMS.
Definition: WMS.cpp:142
std::set< ComputeService * > getAvailableComputeServices()
Obtain the list of compute services available to the WMS.
Definition: WMS.cpp:133
void waitForAndProcessNextEvent()
Wait for a workflow execution event and then call the associated function to process that event...
Definition: WMS.cpp:169
A (mostly virtual) base class for implementing StandardJob scheduling algorithms to be used by a WMS...
Definition: StandardJobScheduler.h:31
A helper daemon (co-located with and explicitly started by a WMS), which is used to handle all job ex...
Definition: JobManager.h:40
Workflow * getWorkflow()
Get the workflow that was assigned to the WMS.
Definition: WMS.cpp:299
A workflow management system (WMS)
Definition: WMS.h:33
std::set< NetworkProximityService * > getAvailableNetworkProximityServices()
Obtain the list of network proximity services available to the WMS.
Definition: WMS.cpp:151
std::shared_ptr< JobManager > createJobManager()
Instantiate and start a job manager.
Definition: WMS.cpp:307
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
void runStaticOptimizations()
Perform static optimizations. Optimizations are executed in order of insertion.
Definition: WMS.cpp:122
Definition: TerminalOutput.cpp:15
virtual void processEventStandardJobCompletion(std::unique_ptr< StandardJobCompletedEvent >)
Process a WorkflowExecutionEvent::STANDARD_JOB_COMPLETION.
Definition: WMS.cpp:217
virtual void processEventPilotJobExpiration(std::unique_ptr< PilotJobExpiredEvent >)
Process a WorkflowExecutionEvent::PILOT_JOB_EXPIRATION event.
Definition: WMS.cpp:245