DataMovementManager.h
1 
11 #ifndef WRENCH_DATAMOVEMENTMANAGER_H
12 #define WRENCH_DATAMOVEMENTMANAGER_H
13 
14 
15 #include "wrench/simgrid_S4U_util/S4U_Daemon.h"
16 
17 namespace wrench {
18 
19  class Workflow;
20  class WorkflowFile;
21  class StorageService;
22  class WMS;
23 
24  /***********************/
26  /***********************/
27 
31  class DataMovementManager : public Service {
32 
33  public:
34 
35  void stop();
36 
37  void kill();
38 
40  std::shared_ptr<FileLocation> src,
41  std::shared_ptr<FileLocation> dst,
42  std::shared_ptr<FileRegistryService> file_registry_service=nullptr);
43 
45  std::shared_ptr<FileLocation> src,
46  std::shared_ptr<FileLocation> dst,
47  std::shared_ptr<FileRegistryService> file_registry_service=nullptr);
48 
49  protected:
50 
51  /***********************/
53  /***********************/
54 
55 
56  friend class WMS;
57 
58  explicit DataMovementManager(std::shared_ptr<WMS> wms);
59 
60  /***********************/
62  /***********************/
63 
64  private:
65 
66  int main();
67 
68  std::shared_ptr<WMS> wms = nullptr;
69 
70  bool processNextMessage();
71 
72  struct CopyRequestSpecs {
73  WorkflowFile *file;
74  std::shared_ptr<FileLocation> src;
75  std::shared_ptr<FileLocation> dst;
76  std::shared_ptr<FileRegistryService> file_registry_service;
77 
78  CopyRequestSpecs(WorkflowFile *file,
79  std::shared_ptr<FileLocation> src,
80  std::shared_ptr<FileLocation> dst,
81  std::shared_ptr<FileRegistryService> file_registry_service) :
82  file(file), src(src), dst(dst), file_registry_service(file_registry_service) {}
83 
84  bool operator==(const CopyRequestSpecs &rhs) const {
85  return (file == rhs.file) &&
86  (dst->getStorageService() == rhs.dst->getStorageService()) &&
87  (dst->getAbsolutePathAtMountPoint() == rhs.dst->getAbsolutePathAtMountPoint());
88  }
89  };
90 
91  std::list<std::unique_ptr<CopyRequestSpecs>> pending_file_copies;
92  };
93 
94  /***********************/
96  /***********************/
97 
98 
99 };
100 
101 
102 #endif //WRENCH_DATAMOVEMENTMANAGER_H
void stop()
Stop the manager.
Definition: DataMovementManager.cpp:55
void kill()
Kill the manager (brutally terminate the daemon)
Definition: DataMovementManager.cpp:45
bool operator==(const BatchJobSet &left, const BatchJobSet &right)
Overloaded operator.
Definition: NodeAvailabilityTimeLine.cpp:24
Definition: Alarm.cpp:20
A helper daemon (co-located with a WMS) that handles data movement operations.
Definition: DataMovementManager.h:31
DataMovementManager(std::shared_ptr< WMS > wms)
Constructor.
Definition: DataMovementManager.cpp:34
void initiateAsynchronousFileCopy(WorkflowFile *file, std::shared_ptr< FileLocation > src, std::shared_ptr< FileLocation > dst, std::shared_ptr< FileRegistryService > file_registry_service=nullptr)
Ask the data manager to initiate an asynchronous file copy.
Definition: DataMovementManager.cpp:73
void doSynchronousFileCopy(WorkflowFile *file, std::shared_ptr< FileLocation > src, std::shared_ptr< FileLocation > dst, std::shared_ptr< FileRegistryService > file_registry_service=nullptr)
Ask the data manager to perform a synchronous file copy.
Definition: DataMovementManager.cpp:115
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 data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
A workflow management system (WMS)
Definition: WMS.h:42