Skip to content

Commit

Permalink
some code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Jul 14, 2024
1 parent b718cf3 commit e5c8434
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 22 deletions.
4 changes: 2 additions & 2 deletions doc/source/api_developer.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _developer-api:

WRENCH Developer API
********************
WRENCH Developer C++ API
************************

Runtime System Developers/Researchers use WRENCH to prototype and
evaluate runtime system designs and/or to investigate and evaluate
Expand Down
4 changes: 2 additions & 2 deletions doc/source/api_internal.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _internal-api:

WRENCH Internal API
***************
WRENCH Internal C++ API
***********************

Internal Developers contribute to the WRENCH code, typically by
implementing new Core Services.
Expand Down
4 changes: 2 additions & 2 deletions doc/source/api_user.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _user-api:

WRENCH User API
***************
WRENCH User C++ API
*******************

Runtime System Users use WRENCH to simulate application workload
executions using an already available, in-simulation implementation
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,4 @@ The main channel to reach the WRENCH team is via the support email:
api_developer.rst
api_internal.rst
rest_api.rst
python_api.rst
8 changes: 8 additions & 0 deletions doc/source/python_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
WRENCH Python API
*****************

WRENCH provides a Python API that covers a large fraction of the WRENCH C++ API.

The Python API is `available here <https://github.com/wrench-project/wrench-python-api>` and
documented on `this page <https://wrench-python-api.readthedocs.io/en/latest/>`_

12 changes: 6 additions & 6 deletions include/wrench/services/Service.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace wrench {

void assertServiceIsUp();

double getNetworkTimeoutValue();
double getNetworkTimeoutValue() const;
void setNetworkTimeoutValue(double value);

/***********************/
Expand Down Expand Up @@ -105,19 +105,19 @@ namespace wrench {

~Service() override;

Service(std::string hostname, std::string process_name_prefix);
Service(const std::string& hostname, const std::string& process_name_prefix);

// Property stuff
void setProperty(WRENCH_PROPERTY_TYPE, const std::string &);

void setProperties(WRENCH_PROPERTY_COLLECTION_TYPE default_property_values,
WRENCH_PROPERTY_COLLECTION_TYPE overriden_property_values);
void setProperties(const WRENCH_PROPERTY_COLLECTION_TYPE& default_property_values,
const WRENCH_PROPERTY_COLLECTION_TYPE& overriden_property_values);

// MessagePayload stuff
void setMessagePayload(WRENCH_MESSAGEPAYLOAD_TYPE, double);

void setMessagePayloads(WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values,
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE overriden_messagepayload_values);
void setMessagePayloads(const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE& default_messagepayload_values,
const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE& overriden_messagepayload_values);

void serviceSanityCheck();

Expand Down
13 changes: 6 additions & 7 deletions src/wrench/services/Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/


#include <wrench/simgrid_S4U_util/S4U_CommPort.h>
#include <wrench/simulation/SimulationMessage.h>
#include <wrench/services/ServiceMessage.h>
#include <wrench/simgrid_S4U_util/S4U_Daemon.h>
Expand Down Expand Up @@ -46,7 +45,7 @@ namespace wrench {
* @param hostname: the name of the host on which the service will run
* @param process_name_prefix: the prefix for the process name
*/
Service::Service(std::string hostname, std::string process_name_prefix) : S4U_Daemon(hostname, process_name_prefix) {
Service::Service(const std::string& hostname, const std::string& process_name_prefix) : S4U_Daemon(hostname, process_name_prefix) {
this->name = process_name_prefix;
}

Expand Down Expand Up @@ -412,8 +411,8 @@ namespace wrench {
* @param default_property_values: list of default properties
* @param overridden_property_values: list of overridden properties (override the default)
*/
void Service::setProperties(WRENCH_PROPERTY_COLLECTION_TYPE default_property_values,
WRENCH_PROPERTY_COLLECTION_TYPE overridden_property_values) {
void Service::setProperties(const WRENCH_PROPERTY_COLLECTION_TYPE& default_property_values,
const WRENCH_PROPERTY_COLLECTION_TYPE& overridden_property_values) {
// Set default properties
for (auto const &p: default_property_values) {
this->setProperty(p.first, p.second);
Expand All @@ -430,8 +429,8 @@ namespace wrench {
* @param default_messagepayload_values: list of default message payloads
* @param overridden_messagepayload_values: list of overridden message payloads (override the default)
*/
void Service::setMessagePayloads(WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values,
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE overridden_messagepayload_values) {
void Service::setMessagePayloads(const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE& default_messagepayload_values,
const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE& overridden_messagepayload_values) {
// Set default messagepayloads
for (auto const &p: default_messagepayload_values) {
this->setMessagePayload(p.first, p.second);
Expand All @@ -456,7 +455,7 @@ namespace wrench {
* @brief Returns the service's network timeout value
* @return a duration in seconds
*/
double Service::getNetworkTimeoutValue() {
double Service::getNetworkTimeoutValue() const {
return this->network_timeout;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <wrench/simulation/Simulation.h>
#include <wrench/services/helper_services/service_termination_detector/ServiceTerminationDetector.h>
#include <wrench/services/helper_services/host_state_change_detector/HostStateChangeDetector.h>
#include <wrench/failure_causes/HostError.h>

WRENCH_LOG_CATEGORY(wrench_core_action_scheduler, "Log category for Action Scheduler");

Expand Down
1 change: 0 additions & 1 deletion tools/wrench/wrench-daemon/src/SimulationLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include <string>
#include <utility>
#include <vector>

#include <wrench.h>

Expand Down
1 change: 0 additions & 1 deletion tools/wrench/wrench-daemon/src/WRENCHDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <thread>
#include <boost/program_options.hpp>
#include <nlohmann/json.hpp>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/shm.h>

Expand Down

0 comments on commit e5c8434

Please sign in to comment.