Skip to content

Commit ca77fe4

Browse files
committed
Committing clang-format changes
1 parent 68ac003 commit ca77fe4

File tree

3 files changed

+100
-102
lines changed

3 files changed

+100
-102
lines changed

src/wrench/services/storage/storage_helper_classes/LogicalFileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ namespace wrench {
269269
WRENCH_WARN("LogicalFileSystem::reserveSpace(): Space was already being reserved for storing file %s at path %s:%s. "
270270
"This is likely a redundant copy, and nothing needs to be done",
271271
file->getID().c_str(), this->hostname.c_str(), fixed_path.c_str());
272-
return true;
272+
return true;
273273
}
274274

275275
if (this->free_space < file->getSize()) {

tools/wrench/wrench-daemon/include/SimulationController.h

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ namespace wrench {
117117
json getVMComputeService(json data);
118118

119119
private:
120-
121120
template<class T>
122121
json startService(T *s);
123122

tools/wrench/wrench-daemon/src/SimulationController.cpp

Lines changed: 99 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,25 @@
2020

2121
WRENCH_LOG_CATEGORY(simulation_controller, "Log category for SimulationController");
2222

23-
#define PARSE_SERVICE_PROPERTY_LIST() WRENCH_PROPERTY_COLLECTION_TYPE service_property_list; \
24-
{ \
25-
json jsonData = json::parse(property_list_string); \
26-
for (auto it = jsonData.cbegin(); it != jsonData.cend(); ++it) { \
27-
auto property_key = ServiceProperty::translateString(it.key()); \
28-
service_property_list[property_key] = it.value(); \
29-
} \
30-
}
31-
32-
#define PARSE_MESSAGE_PAYLOAD_LIST() WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE service_message_payload_list; \
33-
{ \
34-
json jsonData = json::parse(message_payload_list_string); \
35-
for (auto it = jsonData.cbegin(); it != jsonData.cend(); ++it) { \
36-
auto message_payload_key = ServiceMessagePayload::translateString(it.key()); \
37-
service_message_payload_list[message_payload_key] = it.value(); \
38-
} \
39-
}
23+
#define PARSE_SERVICE_PROPERTY_LIST() \
24+
WRENCH_PROPERTY_COLLECTION_TYPE service_property_list; \
25+
{ \
26+
json jsonData = json::parse(property_list_string); \
27+
for (auto it = jsonData.cbegin(); it != jsonData.cend(); ++it) { \
28+
auto property_key = ServiceProperty::translateString(it.key()); \
29+
service_property_list[property_key] = it.value(); \
30+
} \
31+
}
32+
33+
#define PARSE_MESSAGE_PAYLOAD_LIST() \
34+
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE service_message_payload_list; \
35+
{ \
36+
json jsonData = json::parse(message_payload_list_string); \
37+
for (auto it = jsonData.cbegin(); it != jsonData.cend(); ++it) { \
38+
auto message_payload_key = ServiceMessagePayload::translateString(it.key()); \
39+
service_message_payload_list[message_payload_key] = it.value(); \
40+
} \
41+
}
4042

4143
namespace wrench {
4244

@@ -50,11 +52,11 @@ namespace wrench {
5052
const std::string &hostname, int sleep_us) : ExecutionController(hostname, "SimulationController"), workflow(workflow), sleep_us(sleep_us) {}
5153

5254

53-
template <class T>
55+
template<class T>
5456
json SimulationController::startService(T *s) {
5557
BlockingQueue<std::pair<bool, std::string>> s_created;
5658

57-
this->things_to_do.push([this, s, &s_created](){
59+
this->things_to_do.push([this, s, &s_created]() {
5860
try {
5961
auto new_service_shared_ptr = this->simulation->startNewService(s);
6062
if (auto cs = std::dynamic_pointer_cast<wrench::ComputeService>(new_service_shared_ptr)) {
@@ -106,10 +108,10 @@ namespace wrench {
106108

107109
// Main control loop
108110
while (keep_going) {
109-
111+
110112
// Starting compute and storage services that should be started, if any
111113
while (true) {
112-
std::function<void()> thing_to_do;
114+
std::function<void()> thing_to_do;
113115

114116
if (this->things_to_do.tryPop(thing_to_do)) {
115117
thing_to_do();
@@ -128,7 +130,7 @@ namespace wrench {
128130
// Moves time forward if needed (because the client has done a sleep),
129131
// And then add all events that occurred to the event queue
130132
double time_to_sleep = std::max<double>(0, time_horizon_to_reach -
131-
wrench::Simulation::getCurrentSimulatedDate());
133+
wrench::Simulation::getCurrentSimulatedDate());
132134
if (time_to_sleep > 0.0) {
133135
WRENCH_INFO("Sleeping %.2lf seconds", time_to_sleep);
134136
S4U_Simulation::sleep(time_to_sleep);
@@ -333,7 +335,6 @@ namespace wrench {
333335
auto new_service = new CloudComputeService(hostname, resources, scratch_space,
334336
service_property_list, service_message_payload_list);
335337
return this->startService<wrench::ComputeService>(new_service);
336-
337338
}
338339

339340

@@ -357,7 +358,6 @@ namespace wrench {
357358
auto new_service = new BatchComputeService(hostname, resources, scratch_space,
358359
service_property_list, service_message_payload_list);
359360
return this->startService<wrench::ComputeService>(new_service);
360-
361361
}
362362

363363
/**
@@ -386,15 +386,15 @@ namespace wrench {
386386
BlockingQueue<std::pair<bool, std::string>> vm_created;
387387

388388
// Push the request into the blocking queue (will be a single one!)
389-
this->things_to_do.push([num_cores, ram_memory, service_property_list, service_message_payload_list, cs, &vm_created](){
390-
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
391-
std::string vm_name;
392-
try {
393-
vm_name = cloud_cs->createVM(num_cores, ram_memory, service_property_list, service_message_payload_list);
394-
vm_created.push(std::pair(true, vm_name));
395-
} catch (ExecutionException &e) {
396-
vm_created.push(std::pair(false, e.getCause()->toString()));
397-
}
389+
this->things_to_do.push([num_cores, ram_memory, service_property_list, service_message_payload_list, cs, &vm_created]() {
390+
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
391+
std::string vm_name;
392+
try {
393+
vm_name = cloud_cs->createVM(num_cores, ram_memory, service_property_list, service_message_payload_list);
394+
vm_created.push(std::pair(true, vm_name));
395+
} catch (ExecutionException &e) {
396+
vm_created.push(std::pair(false, e.getCause()->toString()));
397+
}
398398
});
399399

400400
// Poll from the shared queue (will be a single one!)
@@ -428,20 +428,20 @@ namespace wrench {
428428

429429
BlockingQueue<std::pair<bool, std::string>> vm_started;
430430
// Push the request into the blocking queue (will be a single one!)
431-
this->things_to_do.push([this, vm_name, cs, &vm_started](){
432-
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
433-
try {
434-
if (not cloud_cs->isVMDown(vm_name)) {
435-
throw std::invalid_argument("Cannot start VM because it's not down");
436-
}
437-
auto bm_cs = cloud_cs->startVM(vm_name);
438-
this->compute_service_registry.insert(bm_cs->getName(), bm_cs);
439-
vm_started.push(std::pair(true, bm_cs->getName()));
440-
} catch (ExecutionException &e) {
441-
vm_started.push(std::pair(false, e.getCause()->toString()));
442-
} catch (std::invalid_argument &e) {
443-
vm_started.push(std::pair(false, e.what()));
444-
}
431+
this->things_to_do.push([this, vm_name, cs, &vm_started]() {
432+
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
433+
try {
434+
if (not cloud_cs->isVMDown(vm_name)) {
435+
throw std::invalid_argument("Cannot start VM because it's not down");
436+
}
437+
auto bm_cs = cloud_cs->startVM(vm_name);
438+
this->compute_service_registry.insert(bm_cs->getName(), bm_cs);
439+
vm_started.push(std::pair(true, bm_cs->getName()));
440+
} catch (ExecutionException &e) {
441+
vm_started.push(std::pair(false, e.getCause()->toString()));
442+
} catch (std::invalid_argument &e) {
443+
vm_started.push(std::pair(false, e.what()));
444+
}
445445
});
446446

447447
// Poll from the shared queue (will be a single one!)
@@ -477,22 +477,22 @@ namespace wrench {
477477

478478
// Push the request into the blocking queue (will be a single one!)
479479
//this->vm_to_shutdown.push(std::pair(vm_name, cs));
480-
this->things_to_do.push([this, vm_name, cs, &vm_shutdown](){
481-
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
482-
try {
483-
if (not cloud_cs->isVMRunning(vm_name)) {
484-
throw std::invalid_argument("Cannot shutdown VM because it's not running");
485-
}
486-
auto bm_cs = cloud_cs->getVMComputeService(vm_name);
487-
488-
this->compute_service_registry.remove(bm_cs->getName());
489-
cloud_cs->shutdownVM(vm_name);
490-
vm_shutdown.push(std::pair(true, vm_name));
491-
} catch (ExecutionException &e) {
492-
vm_shutdown.push(std::pair(false, e.what()));
493-
} catch (std::invalid_argument &e) {
494-
vm_shutdown.push(std::pair(false, e.what()));
495-
}
480+
this->things_to_do.push([this, vm_name, cs, &vm_shutdown]() {
481+
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
482+
try {
483+
if (not cloud_cs->isVMRunning(vm_name)) {
484+
throw std::invalid_argument("Cannot shutdown VM because it's not running");
485+
}
486+
auto bm_cs = cloud_cs->getVMComputeService(vm_name);
487+
488+
this->compute_service_registry.remove(bm_cs->getName());
489+
cloud_cs->shutdownVM(vm_name);
490+
vm_shutdown.push(std::pair(true, vm_name));
491+
} catch (ExecutionException &e) {
492+
vm_shutdown.push(std::pair(false, e.what()));
493+
} catch (std::invalid_argument &e) {
494+
vm_shutdown.push(std::pair(false, e.what()));
495+
}
496496
});
497497

498498
// Poll from the shared queue (will be a single one!)
@@ -525,17 +525,17 @@ namespace wrench {
525525
BlockingQueue<std::pair<bool, std::string>> vm_destroyed;
526526

527527
// Push the request into the blocking queue (will be a single one!)
528-
this->things_to_do.push([vm_name, cs, &vm_destroyed](){
529-
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
530-
try {
531-
if (not cloud_cs->isVMDown(vm_name)) {
532-
throw std::invalid_argument("Cannot destroy VM because it's not down");
533-
}
534-
cloud_cs->destroyVM(vm_name);
535-
vm_destroyed.push(std::pair(true, vm_name));
536-
} catch (std::invalid_argument &e) {
537-
vm_destroyed.push(std::pair(false, e.what()));
538-
}
528+
this->things_to_do.push([vm_name, cs, &vm_destroyed]() {
529+
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
530+
try {
531+
if (not cloud_cs->isVMDown(vm_name)) {
532+
throw std::invalid_argument("Cannot destroy VM because it's not down");
533+
}
534+
cloud_cs->destroyVM(vm_name);
535+
vm_destroyed.push(std::pair(true, vm_name));
536+
} catch (std::invalid_argument &e) {
537+
vm_destroyed.push(std::pair(false, e.what()));
538+
}
539539
});
540540

541541
// Poll from the shared queue (will be a single one!)
@@ -562,7 +562,6 @@ namespace wrench {
562562
// Create the new service
563563
auto new_service = SimpleStorageService::createSimpleStorageService(head_host, mount_points, {}, {});
564564
return this->startService<wrench::StorageService>(new_service);
565-
566565
}
567566

568567
/**
@@ -616,13 +615,13 @@ namespace wrench {
616615
BlockingQueue<std::tuple<bool, bool, std::string>> file_looked_up;
617616

618617
// Push the request into the blocking queue (will be a single one!)
619-
this->things_to_do.push([file, ss, &file_looked_up](){
620-
try {
621-
bool result = ss->lookupFile(file);
622-
file_looked_up.push(std::tuple(true, result, ""));
623-
} catch (std::invalid_argument &e) {
624-
file_looked_up.push(std::tuple(false, false, e.what()));
625-
}
618+
this->things_to_do.push([file, ss, &file_looked_up]() {
619+
try {
620+
bool result = ss->lookupFile(file);
621+
file_looked_up.push(std::tuple(true, result, ""));
622+
} catch (std::invalid_argument &e) {
623+
file_looked_up.push(std::tuple(false, false, e.what()));
624+
}
626625
});
627626

628627
// Poll from the shared queue (will be a single one!)
@@ -708,7 +707,7 @@ namespace wrench {
708707
}
709708

710709
BlockingQueue<std::pair<bool, std::string>> job_submitted;
711-
this->things_to_do.push([this, job, cs, service_specific_args, &job_submitted](){
710+
this->things_to_do.push([this, job, cs, service_specific_args, &job_submitted]() {
712711
try {
713712
WRENCH_INFO("Submitting a job...");
714713
this->job_manager->submitJob(job, cs, service_specific_args);
@@ -1036,14 +1035,14 @@ namespace wrench {
10361035
// Push the request into the blocking queue (will be a single one!)
10371036
//this->vm_to_suspend.push(std::pair(vm_name, cs));
10381037
BlockingQueue<std::pair<bool, std::string>> vm_suspended;
1039-
this->things_to_do.push([vm_name, cs, &vm_suspended](){
1040-
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
1041-
try {
1042-
cloud_cs->suspendVM(vm_name);
1043-
vm_suspended.push(std::pair(true, vm_name));
1044-
} catch (std::invalid_argument &e) {
1045-
vm_suspended.push(std::pair(false, e.what()));
1046-
}
1038+
this->things_to_do.push([vm_name, cs, &vm_suspended]() {
1039+
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
1040+
try {
1041+
cloud_cs->suspendVM(vm_name);
1042+
vm_suspended.push(std::pair(true, vm_name));
1043+
} catch (std::invalid_argument &e) {
1044+
vm_suspended.push(std::pair(false, e.what()));
1045+
}
10471046
});
10481047

10491048
// Poll from the shared queue (will be a single one!)
@@ -1097,14 +1096,14 @@ namespace wrench {
10971096
BlockingQueue<std::pair<bool, std::string>> vm_resumed;
10981097

10991098
// Push the request into the blocking queue (will be a single one!)
1100-
this->things_to_do.push([vm_name, cs, &vm_resumed](){
1101-
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
1102-
try {
1103-
cloud_cs->resumeVM(vm_name);
1104-
vm_resumed.push(std::pair(true, vm_name));
1105-
} catch (std::invalid_argument &e) {
1106-
vm_resumed.push(std::pair(false, e.what()));
1107-
}
1099+
this->things_to_do.push([vm_name, cs, &vm_resumed]() {
1100+
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
1101+
try {
1102+
cloud_cs->resumeVM(vm_name);
1103+
vm_resumed.push(std::pair(true, vm_name));
1104+
} catch (std::invalid_argument &e) {
1105+
vm_resumed.push(std::pair(false, e.what()));
1106+
}
11081107
});
11091108

11101109
// Poll from the shared queue (will be a single one!)
@@ -1131,7 +1130,7 @@ namespace wrench {
11311130
}
11321131
auto cloud_cs = std::dynamic_pointer_cast<CloudComputeService>(cs);
11331132
std::vector<std::string> execution_hosts_list = cloud_cs->getHosts();
1134-
json answer {};
1133+
json answer{};
11351134
answer["execution_hosts"] = execution_hosts_list;
11361135
return answer;
11371136
}

0 commit comments

Comments
 (0)