WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
NetworkProximityService.h
1 
10 #ifndef WRENCH_NETWORKPROXIMITYSERVICE_H
11 #define WRENCH_NETWORKPROXIMITYSERVICE_H
12 
13 #include <cfloat>
14 #include <complex>
15 #include <random>
16 #include "wrench/services/Service.h"
17 #include "wrench/services/network_proximity/NetworkProximityServiceProperty.h"
18 #include "wrench/services/network_proximity/NetworkProximityDaemon.h"
19 
20 namespace wrench {
21 
27 
28  private:
29  std::map<std::string, std::string> default_property_values = {
37  };
38 
39  std::map<std::string, double> default_messagepayload_values = {
47  };
48 
49  public:
50  /***********************/
52  /***********************/
53 
58  static constexpr double NOT_AVAILABLE = DBL_MAX;
59 
60  ~NetworkProximityService() override;
61 
62  /***********************/
64  /***********************/
65 
66  NetworkProximityService(std::string db_hostname,
67  std::vector<std::string> hosts_in_network,
68  std::map<std::string, std::string> property_list = {},
69  std::map<std::string, double> messagepayload_list = {}
70  );
71 
72  /***********************/
74  /***********************/
75 
76  std::vector<std::string> getHostnameList();
77 
78  std::pair<double, double> getHostPairDistance(std::pair<std::string, std::string> hosts);
79 
80  std::pair<std::pair<double, double>, double> getHostCoordinate(std::string);
81 
82  std::string getNetworkProximityServiceType();
83 
84  /***********************/
86  /***********************/
87 
88  private:
89  friend class Simulation;
90 
91  std::vector<std::shared_ptr<NetworkProximityDaemon>> network_daemons;
92  std::vector<std::string> hosts_in_network;
93 
94  std::default_random_engine master_rng;
95 
96  int main() override;
97 
98  bool processNextMessage();
99 
100  void addEntryToDatabase(std::pair<std::string, std::string> pair_hosts, double proximity_value);
101 
102  std::map<std::pair<std::string, std::string>, std::pair<double, double>> entries;
103 
104  std::map<std::string, std::pair<std::complex<double>, double>> coordinate_lookup_table;
105 
106  std::shared_ptr<NetworkProximityDaemon>
107  getCommunicationPeer(const std::shared_ptr<NetworkProximityDaemon> sender_daemon);
108 
109  void vivaldiUpdate(double proximityValue, std::string sender_hostname, std::string peer_hostname);
110 
111  void validateProperties();
112  };
113 }
114 
115 #endif //WRENCH_NETWORKPROXIMITYSERVICE_H
wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD
static const std::string NETWORK_PROXIMITY_MEASUREMENT_PERIOD
The inter-measurement period (in seconds) to be used (default: 60)
Definition: NetworkProximityServiceProperty.h:37
wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MESSAGE_SIZE
static const std::string NETWORK_PROXIMITY_MESSAGE_SIZE
The message size (in bytes) to be used in RTT measurements (default: 1024)
Definition: NetworkProximityServiceProperty.h:34
wrench::NetworkProximityServiceMessagePayload::NETWORK_DAEMON_CONTACT_ANSWER_PAYLOAD
static const std::string NETWORK_DAEMON_CONTACT_ANSWER_PAYLOAD
The number of bytes in the message sent by the service to a network proximity daemon in answer to a r...
Definition: NetworkProximityServiceMessagePayload.h:37
wrench::ServiceMessagePayload::DAEMON_STOPPED_MESSAGE_PAYLOAD
static const std::string DAEMON_STOPPED_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to confirm it has terminated.
Definition: ServiceMessagePayload.h:33
wrench::NetworkProximityService::NOT_AVAILABLE
static constexpr double NOT_AVAILABLE
A convenient constant that is returned as a latency between two hosts when no latency estimates are a...
Definition: NetworkProximityService.h:58
wrench::NetworkProximityService::getHostCoordinate
std::pair< std::pair< double, double >, double > getHostCoordinate(std::string)
Look up the current (x,y) coordinates of a given host (only for a Vivaldi network service type)
Definition: NetworkProximityService.cpp:80
wrench::NetworkProximityServiceMessagePayload::NETWORK_DAEMON_CONTACT_REQUEST_PAYLOAD
static const std::string NETWORK_DAEMON_CONTACT_REQUEST_PAYLOAD
The number of bytes in the message sent by a network proximity daemon to the network proximity servic...
Definition: NetworkProximityServiceMessagePayload.h:32
wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_PEER_LOOKUP_SEED
static const std::string NETWORK_PROXIMITY_PEER_LOOKUP_SEED
The random (integer) number generator seed used by the service to pick RTT measurement peers (default...
Definition: NetworkProximityServiceProperty.h:47
wrench
Definition: Alarm.cpp:20
wrench::NetworkProximityServiceMessagePayload::NETWORK_DB_LOOKUP_ANSWER_MESSAGE_PAYLOAD
static const std::string NETWORK_DB_LOOKUP_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the message sent by the service in answer to a request for a proximity value l...
Definition: NetworkProximityServiceMessagePayload.h:27
wrench::NetworkProximityServiceMessagePayload::NETWORK_DAEMON_MEASUREMENT_REPORTING_PAYLOAD
static const std::string NETWORK_DAEMON_MEASUREMENT_REPORTING_PAYLOAD
The number of bytes in the message sent by a network proximity daemon to the network proximity servic...
Definition: NetworkProximityServiceMessagePayload.h:41
wrench::NetworkProximityService::getNetworkProximityServiceType
std::string getNetworkProximityServiceType()
Get the network proximity service type.
Definition: NetworkProximityService.cpp:480
wrench::NetworkProximityServiceMessagePayload::NETWORK_DB_LOOKUP_REQUEST_MESSAGE_PAYLOAD
static const std::string NETWORK_DB_LOOKUP_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the message sent to the service to request a proximity value lookup.
Definition: NetworkProximityServiceMessagePayload.h:24
wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD_MAX_NOISE
static const std::string NETWORK_PROXIMITY_MEASUREMENT_PERIOD_MAX_NOISE
The maximum random uniformly distributed noise (in seconds) to be added to the measurement period (us...
Definition: NetworkProximityServiceProperty.h:41
wrench::NetworkProximityService::NetworkProximityService
NetworkProximityService(std::string db_hostname, std::vector< std::string > hosts_in_network, std::map< std::string, std::string > property_list={}, std::map< std::string, double > messagepayload_list={})
Constructor.
Definition: NetworkProximityService.cpp:48
wrench::NetworkProximityServiceProperty::NETWORK_DAEMON_COMMUNICATION_COVERAGE
static const std::string NETWORK_DAEMON_COMMUNICATION_COVERAGE
The percentage of other network proximity daemons that each network proximity daemon will conduct RTT...
Definition: NetworkProximityServiceProperty.h:44
wrench::NetworkProximityServiceProperty::LOOKUP_OVERHEAD
static const std::string LOOKUP_OVERHEAD
The overhead, in seconds, of looking up entries for a file (default: 0)
Definition: NetworkProximityServiceProperty.h:25
wrench::Service::messagepayload_list
std::map< std::string, double > messagepayload_list
The service's messagepayload list.
Definition: Service.h:112
wrench::NetworkProximityService::getHostPairDistance
std::pair< double, double > getHostPairDistance(std::pair< std::string, std::string > hosts)
Look up a proximity value in database.
Definition: NetworkProximityService.cpp:131
wrench::ServiceMessagePayload::STOP_DAEMON_MESSAGE_PAYLOAD
static const std::string STOP_DAEMON_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to terminate it.
Definition: ServiceMessagePayload.h:31
wrench::NetworkProximityService::getHostnameList
std::vector< std::string > getHostnameList()
Gets the list of hosts monitored by this service (does not involve simulated network communications w...
Definition: NetworkProximityService.cpp:551
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
wrench::NetworkProximityService
A network proximity service that continuously estimates inter-host latencies and can be queried for s...
Definition: NetworkProximityService.h:26
wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_SERVICE_TYPE
static const std::string NETWORK_PROXIMITY_SERVICE_TYPE
The type of network proximity implementation to be used:
Definition: NetworkProximityServiceProperty.h:31
wrench::Service::property_list
std::map< std::string, std::string > property_list
The service's property list.
Definition: Service.h:109
wrench::NetworkProximityService::~NetworkProximityService
~NetworkProximityService() override
Destructor.
Definition: NetworkProximityService.cpp:36