Skip to content

Commit 9e48b44

Browse files
committed
Cleanups
1 parent 09182d9 commit 9e48b44

File tree

4 files changed

+45
-44
lines changed

4 files changed

+45
-44
lines changed

RELEASENOTES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ WRENCH Release Notes
44
### wrench 2.6-dev
55

66
- Implementation of a "backfilling depth" feature for EASY and convervative_bf batch scheduling algorithms
7+
- Upgrade to SimGrid v4.0 and FSMod v0.3
8+
- Minor code/documentation cleanups
79

810
### wrench 2.5
911

1012
- Implementation of the EASY batch scheduling algorithm in BatchComputeService
11-
1213
- New command-line argument for the wrench-daemon to specify the number of commports
1314

1415
### wrench 2.4

conf/cmake/Documentation.cmake

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
find_package(Doxygen QUIET)
2-
if (NOT DOXYGEN_FOUND)
2+
if (NOT DOXYGEN_FOUND)
33
message("-- Doxygen: No (warning: Doxygen is needed in case you want to generate WRENCH documentation)")
44
endif()
55

66
find_program(SWAGGER_CODEGEN_FOUND "swagger-codegen" QUIET)
7-
if (NOT SWAGGER_CODEGEN_FOUND)
7+
if (NOT SWAGGER_CODEGEN_FOUND)
88
message("-- swagger-codegen: No (warning: swagger-codegen is needed in case you want to generate WRENCH documentation)")
99
else()
1010
message("-- Found swagger-codegen")
1111
endif()
1212

1313
find_program(SPHINX_FOUND "sphinx-build" QUIET)
14-
if (NOT SPHINX_FOUND)
14+
if (NOT SPHINX_FOUND)
1515
message("-- sphinx: No (warning: sphinx is needed in case you want to generate WRENCH documentation)")
1616
else()
1717
message("-- Found sphinx")
@@ -42,7 +42,7 @@ if (DOXYGEN_FOUND AND SWAGGER_CODEGEN_FOUND AND SPHINX_FOUND)
4242
add_custom_target(doc-${SECTION_LOWER}
4343
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
4444
COMMENT "Generating WRENCH ${SECTION} documentation" VERBATIM)
45-
add_custom_command(TARGET doc-${SECTION_LOWER}
45+
add_custom_command(TARGET doc-${SECTION_LOWER} POST_BUILD
4646
COMMAND mkdir -p ${CMAKE_HOME_DIRECTORY}/docs/${WRENCH_RELEASE_VERSION}/${SECTION_LOWER}
4747
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT})
4848

@@ -63,24 +63,24 @@ if (DOXYGEN_FOUND AND SWAGGER_CODEGEN_FOUND AND SPHINX_FOUND)
6363
add_custom_target(doc DEPENDS wrench ${WRENCH_SECTIONS_LIST})
6464

6565
add_custom_command(TARGET doc
66-
POST_BUILD
66+
POST_BUILD
6767
COMMAND swagger-codegen generate -i ${CMAKE_HOME_DIRECTORY}/tools/wrench/wrench-daemon/doc/wrench-openapi.json -l html2 -o ${CMAKE_HOME_DIRECTORY}/docs/build/${WRENCH_RELEASE_VERSION}/restapi
6868
COMMENT "Generating REST API HTML"
6969
VERBATIM
70-
)
71-
add_custom_command(TARGET doc COMMAND python3
72-
${CMAKE_HOME_DIRECTORY}/doc/scripts/generate_rst.py
73-
${CMAKE_HOME_DIRECTORY}/docs/${WRENCH_RELEASE_VERSION}
74-
${CMAKE_HOME_DIRECTORY}/doc/source
75-
${WRENCH_RELEASE_VERSION})
76-
add_custom_command(TARGET doc COMMAND sphinx-build
77-
${CMAKE_HOME_DIRECTORY}/doc/source
78-
${CMAKE_HOME_DIRECTORY}/docs/build/${WRENCH_RELEASE_VERSION})
79-
add_custom_command(TARGET doc COMMAND cp -R
80-
${CMAKE_HOME_DIRECTORY}/docs/build/${WRENCH_RELEASE_VERSION}
81-
${CMAKE_HOME_DIRECTORY}/docs/build/latest)
70+
)
71+
add_custom_command(TARGET doc POST_BUILD COMMAND python3
72+
${CMAKE_HOME_DIRECTORY}/doc/scripts/generate_rst.py
73+
${CMAKE_HOME_DIRECTORY}/docs/${WRENCH_RELEASE_VERSION}
74+
${CMAKE_HOME_DIRECTORY}/doc/source
75+
${WRENCH_RELEASE_VERSION})
76+
add_custom_command(TARGET doc POST_BUILD COMMAND sphinx-build
77+
${CMAKE_HOME_DIRECTORY}/doc/source
78+
${CMAKE_HOME_DIRECTORY}/docs/build/${WRENCH_RELEASE_VERSION})
79+
add_custom_command(TARGET doc POST_BUILD COMMAND cp -R
80+
${CMAKE_HOME_DIRECTORY}/docs/build/${WRENCH_RELEASE_VERSION}
81+
${CMAKE_HOME_DIRECTORY}/docs/build/latest)
8282

8383
else()
84-
add_custom_target(doc echo "ERROR: Cannot build documentation because at least one of Doxygen, Swagger-Codegen, or Sphinx is not installed." COMMAND echo " If you have installed them, re-run cmake." VERBATIM)
84+
add_custom_target(doc echo "ERROR: Cannot build documentation because at least one of Doxygen, Swagger-Codegen, or Sphinx is not installed." COMMAND echo " If you have installed them, re-run cmake." VERBATIM)
8585

8686
endif()

include/wrench/tools/wfcommons/WfCommonsWorkflowParser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ namespace wrench {
135135
* @param workflow: a workflow
136136
* @return a JSON string
137137
*/
138-
static std::string createJSONStringFromWorkflow(std::shared_ptr<Workflow> workflow);
138+
static std::string createJSONStringFromWorkflow(const std::shared_ptr<Workflow>& workflow);
139139

140140
};
141141

tools/wfcommons/src/WfCommonsWorkflowParser.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace wrench {
8383

8484
try {
8585
flop_rate = UnitParser::parse_compute_speed(reference_flop_rate);
86-
} catch (std::invalid_argument &e) {
86+
} catch (std::invalid_argument &) {
8787
throw;
8888
}
8989

@@ -93,7 +93,7 @@ namespace wrench {
9393
nlohmann::json schema_version;
9494
try {
9595
schema_version = j.at("schemaVersion");
96-
} catch (std::out_of_range &e) {
96+
} catch (std::out_of_range &) {
9797
throw std::invalid_argument("WfCommonsWorkflowParser::createWorkflowFromJson(): Could not find a 'schema_version' key");
9898
}
9999
if (schema_version != "1.5") {
@@ -104,7 +104,7 @@ namespace wrench {
104104
nlohmann::json workflow_spec;
105105
try {
106106
workflow_spec = j.at("workflow");
107-
} catch (std::out_of_range &e) {
107+
} catch (std::out_of_range &) {
108108
throw std::invalid_argument("WfCommonsWorkflowParser::createWorkflowFromJson(): Could not find a 'workflow' key");
109109
}
110110

@@ -126,13 +126,13 @@ namespace wrench {
126126
unsigned long num_cores;
127127
try {
128128
num_cores = core_spec.at("coreCount");
129-
} catch (nlohmann::detail::out_of_range &e) {
129+
} catch (nlohmann::detail::out_of_range &) {
130130
num_cores = 1;
131131
}
132132
double mhz;
133133
try {
134134
mhz = core_spec.at("speedInMHz");
135-
} catch (nlohmann::detail::out_of_range &e) {
135+
} catch (nlohmann::detail::out_of_range &) {
136136
if (show_warnings) std::cerr << "[WARNING]: Machine " + name + " does not define a speed\n";
137137
mhz = -1.0;// unknown
138138
}
@@ -148,9 +148,9 @@ namespace wrench {
148148
std::shared_ptr<DataFile> data_file;
149149
try {
150150
Simulation::getFileByID(file_name);
151-
} catch (const std::invalid_argument &e) {
151+
} catch (const std::invalid_argument &) {
152152
// making a new file
153-
double file_size = file_spec.at("sizeInBytes");
153+
sg_size_t file_size = file_spec.at("sizeInBytes");
154154
Simulation::addFile(file_name, file_size);
155155
}
156156
}
@@ -190,14 +190,14 @@ namespace wrench {
190190
double avg_cpu = -1.0;
191191
try {
192192
avg_cpu = task_exec.at("avgCPU");
193-
} catch (nlohmann::json::out_of_range &e) {
193+
} catch (nlohmann::json::out_of_range &) {
194194
// do nothing
195195
}
196196

197197
double num_cores = -1.0;
198198
try {
199199
num_cores = task_exec.at("coreCount");
200-
} catch (nlohmann::json::out_of_range &e) {
200+
} catch (nlohmann::json::out_of_range &) {
201201
// do nothing
202202
}
203203
if (num_cores <= 0) {
@@ -224,7 +224,7 @@ namespace wrench {
224224
avg_cpu = 100.0 * num_cores;
225225
} else if (avg_cpu > 100 * num_cores) {
226226
if (show_warnings) {
227-
std::cerr << "[WARNING]: Task " << task->getID() << " specifies " << (unsigned long) num_cores << " cores and avgCPU " << avg_cpu << "%, "
227+
std::cerr << "[WARNING]: Task " << task->getID() << " specifies " << static_cast<unsigned long>(num_cores) << " cores and avgCPU " << avg_cpu << "%, "
228228
<< "which is impossible: Assuming avgCPU " << 100.0 * num_cores << " instead.\n";
229229
}
230230
avg_cpu = 100.0 * num_cores;
@@ -249,13 +249,13 @@ namespace wrench {
249249
// Deal with the flop amount
250250
double flop_amount;
251251
std::string execution_machine;
252-
if (task_exec.contains("machines") and machines.size() > 0) {
253-
std::vector<std::string> machines = task_exec.at("machines");
254-
if (machines.size() > 1) {
252+
if (task_exec.contains("machines") and !machines.empty()) {
253+
std::vector<std::string> task_machines = task_exec.at("machines");
254+
if (task_machines.size() > 1) {
255255
throw std::invalid_argument("WfCommonsWorkflowParser::createWorkflowFromJSON(): Task " + task->getID() +
256256
" was executed on multiple machines, which WRENCH currently does not support");
257257
}
258-
execution_machine = machines.at(0);
258+
execution_machine = task_machines.at(0);
259259
}
260260
if (ignore_machine_specs or execution_machine.empty()) {
261261
flop_amount = runtimeInSeconds * flop_rate;
@@ -267,11 +267,11 @@ namespace wrench {
267267
}
268268
if (machines[execution_machine].second >= 0) {
269269
double core_ghz = (machines[execution_machine].second) / 1000.0;
270-
double total_compute_power_used = core_ghz * (double) min_num_cores;
270+
double total_compute_power_used = core_ghz * static_cast<double>(min_num_cores);
271271
double actual_flop_rate = total_compute_power_used * 1000.0 * 1000.0 * 1000.0;
272272
flop_amount = runtimeInSeconds * actual_flop_rate;
273273
} else {
274-
flop_amount = (double) min_num_cores * runtimeInSeconds * flop_rate;// Assume a min-core execution
274+
flop_amount = static_cast<double>(min_num_cores) * runtimeInSeconds * flop_rate;// Assume a min-core execution
275275
}
276276
}
277277

@@ -312,9 +312,9 @@ namespace wrench {
312312
try {
313313
auto parent_task = workflow->getTaskByID(parent);
314314
workflow->addControlDependency(parent_task, task, redundant_dependencies);
315-
} catch (std::invalid_argument &e) {
315+
} catch (std::invalid_argument &) {
316316
// do nothing
317-
} catch (std::runtime_error &e) {
317+
} catch (std::runtime_error &) {
318318
if (ignore_cycle_creating_dependencies) {
319319
// nothing
320320
} else {
@@ -327,9 +327,9 @@ namespace wrench {
327327
try {
328328
auto child_task = workflow->getTaskByID(child);
329329
workflow->addControlDependency(task, child_task, redundant_dependencies);
330-
} catch (std::invalid_argument &e) {
330+
} catch (std::invalid_argument &) {
331331
// do nothing
332-
} catch (std::runtime_error &e) {
332+
} catch (std::runtime_error &) {
333333
if (ignore_cycle_creating_dependencies) {
334334
// nothing
335335
} else {
@@ -351,7 +351,7 @@ namespace wrench {
351351
* @param workflow
352352
* @return
353353
*/
354-
nlohmann::json build_workflow_specification_json(std::shared_ptr<Workflow> workflow) {
354+
nlohmann::json build_workflow_specification_json(const std::shared_ptr<Workflow>& workflow) {
355355
nlohmann::json json_specification;
356356

357357
// Tasks
@@ -390,7 +390,7 @@ namespace wrench {
390390
auto file = item.second;
391391
nlohmann::json json_file;
392392
json_file["id"] = file->getID();
393-
json_file["sizeInBytes"] = (long long)(file->getSize());
393+
json_file["sizeInBytes"] = static_cast<long long>(file->getSize());
394394
json_specification["files"].push_back(json_file);
395395
}
396396

@@ -402,7 +402,7 @@ namespace wrench {
402402
* @param workflow
403403
* @return
404404
*/
405-
nlohmann::json build_workflow_execution_json(std::shared_ptr<Workflow> workflow) {
405+
nlohmann::json build_workflow_execution_json(const std::shared_ptr<Workflow>& workflow) {
406406
nlohmann::json json_execution;
407407

408408
json_execution["makespanInSeconds"] = workflow->getCompletionDate() - workflow->getStartDate();
@@ -430,7 +430,7 @@ namespace wrench {
430430
/**
431431
* Documentation in .h file
432432
*/
433-
std::string WfCommonsWorkflowParser::createJSONStringFromWorkflow(std::shared_ptr<Workflow> workflow) {
433+
std::string WfCommonsWorkflowParser::createJSONStringFromWorkflow(const std::shared_ptr<Workflow>& workflow) {
434434
nlohmann::json json_doc;
435435
json_doc["name"] = workflow->getName();
436436
json_doc["description"] = "Generated from a WRENCH simulator";

0 commit comments

Comments
 (0)