wrench::Service

class 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::HTCondorNegotiatorService, wrench::HostStateChangeDetector, 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

const WRENCH_PROPERTY_COLLECTION_TYPE &getPropertyList() const

Get all properties attached to this service.

Returns

the property list

double getPropertyValueAsBandwidthInBytePerSecond(WRENCH_PROPERTY_TYPE)

Method to parse a property value that is a bandwidth with (optional) units.

Parameters

property – the property

Returns

the bandwidth in byte/sec

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

double getPropertyValueAsSizeInByte(WRENCH_PROPERTY_TYPE)

Method to parse a property value that is a date size with (optional) units.

Parameters

property – the property

Returns

the size in byte

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

double getPropertyValueAsTimeInSecond(WRENCH_PROPERTY_TYPE)

Method to parse a property value that is a time with (optional) units.

Parameters

property – the property

Returns

the time in second

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.