WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
DataMovementManager.h
1 
11 #ifndef WRENCH_DATAMOVEMENTMANAGER_H
12 #define WRENCH_DATAMOVEMENTMANAGER_H
13 
14 #include <list>
15 
16 #include "wrench/simgrid_S4U_util/S4U_Daemon.h"
17 #include "wrench/services/storage/storage_helpers/FileLocation.h"
18 
19 namespace wrench {
20 
21  class Workflow;
22  class DataFile;
23  class StorageService;
24  class FileRegistryService;
25  class ExecutionController;
26  class WMS;
27 
28  /***********************/
30  /***********************/
31 
35  class DataMovementManager : public Service {
36 
37  public:
38 
39  void stop() override;
40 
41  void kill();
42 
43  void initiateAsynchronousFileCopy(std::shared_ptr<DataFile>file,
44  std::shared_ptr<FileLocation> src,
45  std::shared_ptr<FileLocation> dst,
46  std::shared_ptr<FileRegistryService> file_registry_service=nullptr);
47 
48  void doSynchronousFileCopy(std::shared_ptr<DataFile>file,
49  std::shared_ptr<FileLocation> src,
50  std::shared_ptr<FileLocation> dst,
51  std::shared_ptr<FileRegistryService> file_registry_service=nullptr);
52 
53 
54  protected:
55 
56  /***********************/
58  /***********************/
59 
60  friend class WMS;
61  friend class ExecutionController;
62 
63  explicit DataMovementManager(std::string hostname, simgrid::s4u::Mailbox *creator_mailbox);
64 
65  /***********************/
67  /***********************/
68 
69  private:
70 
71  int main() override;
72 
73  simgrid::s4u::Mailbox *getCreatorMailbox();
74 
75  simgrid::s4u::Mailbox *creator_mailbox;
76 
77  bool processNextMessage();
78 
79  struct CopyRequestSpecs {
80  std::shared_ptr<DataFile>file;
81  std::shared_ptr<FileLocation> src;
82  std::shared_ptr<FileLocation> dst;
83  std::shared_ptr<FileRegistryService> file_registry_service;
84 
85  ~CopyRequestSpecs() {
86  }
87 
88  CopyRequestSpecs(std::shared_ptr<DataFile> file,
89  std::shared_ptr<FileLocation> src,
90  std::shared_ptr<FileLocation> dst,
91  std::shared_ptr<FileRegistryService> file_registry_service) :
92  file(file), src(src), dst(dst), file_registry_service(file_registry_service) {}
93 
94  bool operator==(const CopyRequestSpecs &rhs) const {
95  return (file == rhs.file) &&
96  (dst->getStorageService() == rhs.dst->getStorageService()) &&
97  (dst->getAbsolutePathAtMountPoint() == rhs.dst->getAbsolutePathAtMountPoint());
98  }
99  };
100 
101  std::list<std::unique_ptr<CopyRequestSpecs>> pending_file_copies;
102  };
103 
104  /***********************/
106  /***********************/
107 
108 
109 };
110 
111 
112 #endif //WRENCH_DATAMOVEMENTMANAGER_H
wrench::ExecutionController
An abstraction of an execution controller, i.e., a running process that interacts with other services...
Definition: ExecutionController.h:37
wrench::DataMovementManager::kill
void kill()
Kill the manager (brutally terminate the daemon)
Definition: DataMovementManager.cpp:46
wrench::operator==
bool operator==(const BatchJobSet &left, const BatchJobSet &right)
Overloaded operator.
Definition: NodeAvailabilityTimeLine.cpp:24
wrench::DataMovementManager::initiateAsynchronousFileCopy
void initiateAsynchronousFileCopy(std::shared_ptr< DataFile >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:74
wrench
Definition: Action.cpp:28
wrench::DataMovementManager
A helper daemon (co-located with an execution controler) that handles data movement operations.
Definition: DataMovementManager.h:35
wrench::DataMovementManager::DataMovementManager
DataMovementManager(std::string hostname, simgrid::s4u::Mailbox *creator_mailbox)
Constructor.
Definition: DataMovementManager.cpp:35
wrench::DataMovementManager::stop
void stop() override
Stop the manager.
Definition: DataMovementManager.cpp:56
wrench::DataMovementManager::doSynchronousFileCopy
void doSynchronousFileCopy(std::shared_ptr< DataFile >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:114
wrench::S4U_Daemon::hostname
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:60
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:31