Skip to content

Commit daa2333

Browse files
committed
comment cleanup
1 parent 8c12037 commit daa2333

File tree

49 files changed

+317
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+317
-303
lines changed

include/wrench/simgrid_S4U_util/S4U_CommPort.h

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*
99
*/
1010

11-
#ifndef WRENCH_S4U_MAILBOX_H
12-
#define WRENCH_S4U_MAILBOX_H
11+
#ifndef WRENCH_S4U_COMMPORT_H
12+
#define WRENCH_S4U_COMMPORT_H
1313

1414

1515
#include <string>
@@ -25,7 +25,6 @@ namespace wrench {
2525
/** \cond INTERNAL */
2626
/***********************/
2727

28-
//class SimulationMessage;
2928
class S4U_PendingCommunication;
3029

3130
/**
@@ -35,32 +34,40 @@ namespace wrench {
3534

3635
public:
3736

37+
38+
template<class TMessageType>
39+
std::string get_type_name() {
40+
char const *type_name = typeid(TMessageType).name();
41+
return boost::core::demangle(type_name);
42+
}
43+
3844
/**
3945
* @brief Constructor
4046
*/
4147
S4U_CommPort() {
42-
this->s4u_mb = simgrid::s4u::Mailbox::by_name("tmp" + std::to_string(S4U_CommPort::generateUniqueSequenceNumber()));
43-
this->name = this->s4u_mb->get_name();
48+
auto number = std::to_string(S4U_CommPort::generateUniqueSequenceNumber());
49+
this->s4u_mb = simgrid::s4u::Mailbox::by_name("mb_" + number);
50+
this->s4u_mq = simgrid::s4u::MessageQueue::by_name("mq_" + number);
51+
this->name = "cp_" + number;
4452
}
4553

4654
/**
47-
* @brief Synchronously receive a message from a commport_name
48-
*
49-
* @param error_prefix: any string you wish to prefix the error message with
50-
* @return the message, in a unique_ptr of the type specified. Otherwise throws a runtime_error
51-
*
52-
* @throw std::shared_ptr<NetworkError>
53-
*/
55+
* @brief Synchronously receive a message from a commport_name
56+
*
57+
* @param error_prefix: any string you wish to prefix the error message with
58+
* @return the message, in a unique_ptr of the type specified. Otherwise throws a runtime_error
59+
*
60+
* @throw std::shared_ptr<NetworkError>
61+
*/
5462
template<class TMessageType>
5563
std::unique_ptr<TMessageType> getMessage(const std::string &error_prefix = "") {
5664
auto id = ++messageCounter;
5765
#ifndef NDEBUG
58-
char const *name = typeid(TMessageType).name();
59-
std::string tn = boost::core::demangle(name);
60-
this->templateWaitingLog(tn, id);
66+
// char const *type_name = typeid(TMessageType).name();
67+
// std::string tn = boost::core::demangle(type_name);
68+
auto tn = this->templateWaitingLog(get_type_name<TMessageType>(), id);
6169
#endif
6270

63-
6471
auto message = this->getMessage(false);
6572

6673
if (auto msg = dynamic_cast<TMessageType *>(message.get())) {
@@ -70,27 +77,30 @@ namespace wrench {
7077
message.release();
7178
return std::unique_ptr<TMessageType>(msg);
7279
} else {
73-
char const *name = typeid(TMessageType).name();
74-
std::string tn = boost::core::demangle(name);
75-
throw std::runtime_error(error_prefix + " Unexpected [" + message->getName() + "] message while waiting for " + tn.c_str() + ". Request ID: " + std::to_string(id));
80+
// char const *type_name = typeid(TMessageType).name();
81+
// std::string tn = boost::core::demangle(type_name);
82+
throw std::runtime_error(error_prefix + " Unexpected [" + message->getName() + "] message while waiting for " +
83+
get_type_name<TMessageType>() + ". Request ID: " + std::to_string(id));
7684
}
7785
}
86+
7887
/**
79-
* @brief Synchronously receive a message from a commport_name
80-
*
81-
* @param error_prefix: any string you wish to prefix the error message with
82-
* @param timeout: a timeout value in seconds (<0 means never timeout)
83-
*
84-
* @return the message, in a unique_ptr of the type specified. Otherwise throws a runtime_error
85-
*
86-
* @throw std::shared_ptr<NetworkError>
87-
*/
88+
* @brief Synchronously receive a message from a commport
89+
*
90+
* @param error_prefix: any string you wish to prefix the error message with
91+
* @param timeout: a timeout value in seconds (<0 means never timeout)
92+
*
93+
* @return the message, in a unique_ptr of the type specified. Otherwise throws a runtime_error
94+
*
95+
* @throw std::shared_ptr<NetworkError>
96+
*/
8897
template<class TMessageType>
8998
std::unique_ptr<TMessageType> getMessage(double timeout, const std::string &error_prefix = "") {
9099
auto id = ++messageCounter;
91100
#ifndef NDEBUG
92-
char const *name = typeid(TMessageType).name();
93-
std::string tn = boost::core::demangle(name);
101+
// char const *type_name = typeid(TMessageType).name();
102+
// std::string tn = boost::core::demangle(type_name);
103+
auto tn = get_type_name<TMessageType>();
94104
this->templateWaitingLog(tn, id);
95105
#endif
96106

@@ -104,32 +114,36 @@ namespace wrench {
104114
#endif
105115
return std::unique_ptr<TMessageType>(msg);
106116
} else {
107-
char const *name = typeid(TMessageType).name();
108-
std::string tn = boost::core::demangle(name);
109-
throw std::runtime_error(error_prefix + " Unexpected [" + message->getName() + "] message while waiting for " + tn.c_str() + ". Request ID: " + std::to_string(id));
117+
// char const *type_name = typeid(TMessageType).name();
118+
// std::string tn = boost::core::demangle(type_name);
119+
throw std::runtime_error(error_prefix + " Unexpected [" + message->getName() + "] message while waiting for " +
120+
get_type_name<TMessageType>() + ". Request ID: " + std::to_string(id));
110121
}
111122
}
123+
112124
/**
113-
* @brief Synchronously receive a message from a commport_name
114-
*
115-
* @return the message, or nullptr (in which case it's likely a brutal termination)
116-
*
117-
* @throw std::shared_ptr<NetworkError>
118-
*/
125+
* @brief Synchronously receive a message from a commport_name
126+
*
127+
* @return the message, or nullptr (in which case it's likely a brutal termination)
128+
*
129+
* @throw std::shared_ptr<NetworkError>
130+
*/
119131
std::unique_ptr<SimulationMessage> getMessage() {
120132
return getMessage(true);
121133
}
134+
122135
/**
123-
* @brief Synchronously receive a message from a commport_name, with a timeout
124-
*
125-
* @param timeout: a timeout value in seconds (<0 means never timeout)
126-
* @return the message, or nullptr (in which case it's likely a brutal termination)
127-
*
128-
* @throw std::shared_ptr<NetworkError>
129-
*/
136+
* @brief Synchronously receive a message from a commport_name, with a timeout
137+
*
138+
* @param timeout: a timeout value in seconds (<0 means never timeout)
139+
* @return the message, or nullptr (in which case it's likely a brutal termination)
140+
*
141+
* @throw std::shared_ptr<NetworkError>
142+
*/
130143
std::unique_ptr<SimulationMessage> getMessage(double timeout) {
131144
return this->getMessage(timeout, true);
132145
}
146+
133147
void putMessage(SimulationMessage *m);
134148
void dputMessage(SimulationMessage *msg);
135149
std::shared_ptr<S4U_PendingCommunication> iputMessage(SimulationMessage *msg);
@@ -139,7 +153,6 @@ namespace wrench {
139153

140154
static S4U_CommPort *getTemporaryCommPort();
141155
static void retireTemporaryCommPort(S4U_CommPort *commport);
142-
143156
static void createCommPortPool(unsigned long num_commports);
144157

145158
/**
@@ -156,13 +169,13 @@ namespace wrench {
156169
* @brief The "not a commport_name" commport_name, to avoid getting answers back when asked
157170
* to prove an "answer commport_name"
158171
*/
159-
static S4U_CommPort *NULL_MAILBOX;
172+
static S4U_CommPort *NULL_COMMPORT;
160173

161174
const std::string get_name() const {
162175
return this->name;
163176
}
164177

165-
const char *get_cname() const {
178+
[[nodiscard]] const char *get_cname() const {
166179
return this->name.c_str();
167180
}
168181

@@ -171,6 +184,7 @@ namespace wrench {
171184
friend class S4U_PendingCommunication;
172185

173186
simgrid::s4u::Mailbox *s4u_mb;
187+
simgrid::s4u::MessageQueue *s4u_mq;
174188

175189
std::unique_ptr<SimulationMessage> getMessage(bool log);
176190
std::unique_ptr<SimulationMessage> getMessage(double timeout, bool log);
@@ -194,4 +208,4 @@ namespace wrench {
194208
}// namespace wrench
195209

196210

197-
#endif//WRENCH_S4U_MAILBOX_H
211+
#endif//WRENCH_S4U_COMMPORT_H

include/wrench/simgrid_S4U_util/S4U_Daemon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ namespace wrench {
167167
}// namespace wrench
168168

169169

170-
#endif//WRENCH_SIM4U_DAEMONWITHMAILBOX_H
170+
#endif//WRENCH_SIM4U_DAEMON_H

include/wrench/simgrid_S4U_util/S4U_DaemonActor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ namespace wrench {
6161
}// namespace wrench
6262

6363

64-
#endif//WRENCH_SIM4U_DAEMONWITHMAILBOXACTOR_H
64+
#endif//WRENCH_SIM4U_DAEMONACTOR_H

src/wrench/execution_events/ExecutionEvent.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ namespace wrench {
2626

2727
/**
2828
* @brief Block the calling process until a ExecutionEvent is generated
29-
* based on messages received on a commport_name, or until a timeout ooccurs
29+
* based on messages received on a commport, or until a timeout ooccurs
3030
*
31-
* @param commport: the name of the receiving commport_name
31+
* @param commport: the name of the receiving commport
3232
* @param timeout: a timeout value in seconds (-1 means: no timeout)
3333
* @return a workflow execution event (or nullptr in case of a timeout)
3434
*
@@ -37,7 +37,7 @@ namespace wrench {
3737
*/
3838
std::shared_ptr<ExecutionEvent>
3939
ExecutionEvent::waitForNextExecutionEvent(S4U_CommPort *commport, double timeout) {
40-
// Get the message from the commport_name
40+
// Get the message from the commport
4141
std::shared_ptr<SimulationMessage> message = nullptr;
4242
try {
4343
message = commport->getMessage<SimulationMessage>(timeout);

src/wrench/failure_causes/NetworkError.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace wrench {
2525
* @param operation_type: NetworkError:OperationType::SENDING or NetworkError::OperationType::RECEIVING or
2626
* NetworkError::OperationType::UNKNOWN
2727
* @param error_type: the error type
28-
* @param commport_name: the name of a commport_name (or "" if unknown)
28+
* @param commport_name: the name of a commport (or "" if unknown)
2929
*/
3030
NetworkError::NetworkError(NetworkError::OperationType operation_type,
3131
NetworkError::ErrorType error_type,
@@ -64,7 +64,7 @@ namespace wrench {
6464

6565
/**
6666
* @brief Returns the name of the CommPort on which the error occurred
67-
* @return the commport_name name
67+
* @return the commport name
6868
*/
6969
std::string NetworkError::getCommPortName() {
7070
return this->commport_name;
@@ -87,7 +87,7 @@ namespace wrench {
8787
} else {
8888
error = "link failure, or communication peer died";
8989
}
90-
return "Network error (" + error + ") while " + operation + " commport_name " + this->commport_name;
90+
return "Network error (" + error + ") while " + operation + " commport " + this->commport_name;
9191
}
9292

9393

src/wrench/job/Job.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ namespace wrench {
5353
}
5454

5555
/**
56-
* @brief Get the "origin" callback commport_name
56+
* @brief Get the "origin" callback commport
5757
*
58-
* @return the next callback commport_name
58+
* @return the next callback commport
5959
*/
6060
S4U_CommPort *Job::getOriginCallbackCommPort() {
6161
return this->originator_commport;
@@ -75,11 +75,11 @@ namespace wrench {
7575
}
7676

7777
/**
78-
* @brief Get the "next" callback commport_name (returns the
79-
* workflow commport_name if the commport_name stack is empty), and
78+
* @brief Get the "next" callback commport (returns the
79+
* workflow commport if the commport stack is empty), and
8080
* pops it
8181
*
82-
* @return the next callback commport_name
82+
* @return the next callback commport
8383
*/
8484
S4U_CommPort *Job::popCallbackCommPort() {
8585
if (this->callback_commport_stack.empty()) {
@@ -91,8 +91,8 @@ namespace wrench {
9191
}
9292

9393
/**
94-
* @brief Get the job's "next" callback commport_name, without popping it
95-
* @return the next callback commport_name
94+
* @brief Get the job's "next" callback commport, without popping it
95+
* @return the next callback commport
9696
*/
9797
S4U_CommPort *Job::getCallbackCommPort() {
9898
if (this->callback_commport_stack.empty()) {
@@ -102,9 +102,9 @@ namespace wrench {
102102
}
103103

104104
/**
105-
* @brief Pushes a callback commport_name
105+
* @brief Pushes a callback commport
106106
*
107-
* @param commport: the commport_name name
107+
* @param commport: the commport name
108108
*/
109109
void Job::pushCallbackCommPort(S4U_CommPort *commport) {
110110
this->callback_commport_stack.push(commport);

src/wrench/managers/data_movement_manager/DataMovementManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace wrench {
3434
* @brief Constructor
3535
*
3636
* @param hostname: the hostname on which the data movement manager is to run
37-
* @param creator_commport: the commport_name of the manager's creator
37+
* @param creator_commport: the commport of the manager's creator
3838
*/
3939
DataMovementManager::DataMovementManager(std::string hostname, S4U_CommPort *creator_commport) : Service(hostname, "data_movement_manager") {
4040
this->creator_commport = creator_commport;

src/wrench/managers/data_movement_manager/FileReaderThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace wrench {
2525
* @brief Constructor
2626
*
2727
* @param hostname: the hostname on which the data movement manager is to run
28-
* @param creator_commport: the commport_name of the manager's creator
28+
* @param creator_commport: the commport of the manager's creator
2929
* @param location: the read location
3030
* @param num_bytes: the number of bytes to read
3131
*/

src/wrench/managers/data_movement_manager/FileWriterThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace wrench {
2525
* @brief Constructor
2626
*
2727
* @param hostname: the hostname on which the data movement manager is to run
28-
* @param creator_commport: the commport_name of the manager's creator
28+
* @param creator_commport: the commport of the manager's creator
2929
* @param location: the write location
3030
*/
3131
FileWriterThread::FileWriterThread(std::string hostname,

src/wrench/managers/job_manager/JobManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace wrench {
3535
* @brief Constructor
3636
*
3737
* @param hostname: the name of host on which the job manager will run
38-
* @param creator_commport: the commport_name of the manager's creator
38+
* @param creator_commport: the commport of the manager's creator
3939
*/
4040
JobManager::JobManager(std::string hostname, S4U_CommPort *creator_commport) : Service(std::move(hostname), "job_manager") {
4141
this->creator_commport = creator_commport;
@@ -1214,9 +1214,9 @@ namespace wrench {
12141214
}
12151215

12161216
/**
1217-
* @brief Return the commport_name of the job manager's creator
1217+
* @brief Return the commport of the job manager's creator
12181218
*
1219-
* @return a commport_name
1219+
* @return a CommPort
12201220
*/
12211221
S4U_CommPort *JobManager::getCreatorCommPort() {
12221222
return this->creator_commport;

src/wrench/services/Service.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ namespace wrench {
309309

310310
WRENCH_INFO("Telling the daemon listening on (%s) to terminate", this->commport->get_cname());
311311

312-
// Send a termination message to the daemon's commport_name - SYNCHRONOUSLY
312+
// Send a termination message to the daemon's commport - SYNCHRONOUSLY
313313
auto ack_commport = S4U_Daemon::getRunningActorRecvCommPort();
314314
std::unique_ptr<SimulationMessage> message = nullptr;
315315
try {

src/wrench/services/ServiceMessage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace wrench {
2020

2121
/**
2222
* @brief Constructor
23-
* @param ack_commport: commport_name to which the DaemonStoppedMessage ack will be sent. No ack will be sent if ack_commport=""
23+
* @param ack_commport: commport to which the DaemonStoppedMessage ack will be sent. No ack will be sent if ack_commport=""
2424
* @param send_failure_notifications: whether the service should send failure notifications before terminating
2525
* @param termination_cause: the termination cause (if failure notifications are sent)
2626
* @param payload: message size in bytes

0 commit comments

Comments
 (0)