wrench::Service

class wrench::Service : public wrench::S4U_Daemon, public std::enable_shared_from_this<Service>

A service that can be added to the simulation and that can be used by a WMS when executing a workflow.

Subclassed by wrench::ActionExecutionService, wrench::Alarm, wrench::BandwidthMeterService, wrench::ComputeService, wrench::DataMovementManager, wrench::EnergyMeterService, wrench::ExecutionController, wrench::FileRegistryService, wrench::FileTransferThread, wrench::HostStateChangeDetector, wrench::HTCondorNegotiatorService, wrench::JobManager, wrench::MemoryManager, wrench::NetworkProximityDaemon, wrench::NetworkProximityService, wrench::ServiceTerminationDetector, wrench::StorageService

Public Functions

void assertServiceIsUp()

Throws an exception if the service is not up.

Throws

ExecutionException

std::string getHostname()

Get the name of the host on which the service is / will be running.

Returns

the hostname

const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE &getMessagePayloadList() const

Get all message payloads and their values of the Service.

Returns

the message payload map

double getMessagePayloadValue(WRENCH_MESSAGEPAYLOAD_TYPE)

Get a message payload of the Service as a double.

Parameters

message_payload – the message payload

Throws

std::invalid_argument

Returns

the message payload value as a double

double getNetworkTimeoutValue()

Returns the service’s network timeout value.

Returns

a duration in seconds

std::string getPhysicalHostname()

Get the physical name of the host on which the service is / will be running.

Returns

the physical hostname

bool getPropertyValueAsBoolean(WRENCH_PROPERTY_TYPE)

Get a property of the Service as a boolean.

Parameters

property – the property

Throws

std::invalid_argument

Returns

the property value as a boolean

double getPropertyValueAsDouble(WRENCH_PROPERTY_TYPE)

Get a property of the Service as a double.

Parameters

property – the property

Throws

std::invalid_argument

Returns

the property value as a double

std::string getPropertyValueAsString(WRENCH_PROPERTY_TYPE)

Get a property of the Service as a string.

Parameters

property – the property

Throws

std::invalid_argument

Returns

the property value as a string

unsigned long getPropertyValueAsUnsignedLong(WRENCH_PROPERTY_TYPE)

Get a property of the Service as an unsigned long.

Parameters

property – the property

Throws

std::invalid_argument

Returns

the property value as an unsigned long

bool isUp()

Returns true if the service is UP, false otherwise.

Returns

true or false

void resume()

Resume the service.

Throws

ExecutionException

void setNetworkTimeoutValue(double value)

Sets the service’s network timeout value.

Parameters

value – a duration in seconds (<0 means: never timeout)

void setStateToDown()

Set the state of the service to DOWN.

void start(std::shared_ptr<Service> this_service, bool daemonize, bool auto_restart)

Start the service.

Parameters
  • this_service – a shared pointer to the service

  • daemonize – true if the daemon is to be daemonized, false otherwise

  • auto_restart – true if the daemon should restart automatically after a reboot or not

Throws
  • std::runtime_error

  • std::shared_ptr<HostError>

virtual void stop()

Synchronously stop the service (does nothing if the service is already stopped)

Throws
void suspend()

Suspend the service.