A generic "running daemon" abstraction that serves as a basis for all simulated processes. More...

#include <S4U_Daemon.h>

Inheritance diagram for wrench::S4U_Daemon:
wrench::Service wrench::Alarm wrench::BatschedNetworkListener wrench::ComputeService wrench::ComputeThread wrench::DataMovementManager wrench::EnergyMeter wrench::FileRegistryService wrench::HTCondorNegotiatorService wrench::JobManager wrench::NetworkProximityDaemon wrench::NetworkProximityService wrench::ServiceFailureDetector wrench::StandardJobExecutor wrench::StorageService wrench::WMS wrench::WorkunitExecutor

Public Member Functions

 S4U_Daemon (std::string hostname, std::string process_name_prefix, std::string mailbox_prefix)
 Constructor (daemon with a mailbox) More...
 
virtual ~S4U_Daemon ()
 Constructor (daemon without a mailbox) More...
 
virtual void cleanup ()
 Cleanup function called when the daemon terminates (for whatever reason)
 
void createLifeSaver (std::shared_ptr< S4U_Daemon > reference)
 Create a life saver for the daemon. More...
 
std::string getName ()
 Retrieve the process name. More...
 
bool hasCleanlyTerminated ()
 Returned the terminated status of the daemon/actor.
 
bool isSetToAutoRestart ()
 Return the auto-restart status of the daemon. More...
 
bool join ()
 Join (i.e., wait for) the daemon. More...
 
virtual int main ()=0
 The daemon's main method, to be overridden. More...
 
void resume ()
 Resume the daemon/actor.
 
void setCleanlyTerminated ()
 Set the terminated status of the daemon/actor.
 
void startDaemon (bool daemonized, bool auto_restart)
 Start the daemon. More...
 
void suspend ()
 Suspend the daemon/actor.
 

Public Attributes

std::string hostname
 The name of the host on which the daemon is running.
 
LifeSaver * life_saver = nullptr
 The daemon's life saver.
 
std::string mailbox_name
 The name of the daemon's mailbox.
 
std::string process_name
 The name of the daemon.
 
Simulationsimulation
 a pointer to the simulation object
 

Protected Member Functions

void acquireDaemonLock ()
 Lock the daemon's lock.
 
void killActor ()
 Kill the daemon/actor.
 
void releaseDaemonLock ()
 Unlock the daemon's lock.
 
void runMainMethod ()
 Method that run's the user-defined main method (that's called by the S4U actor class)
 

Protected Attributes

unsigned int num_starts = 0
 

Detailed Description

A generic "running daemon" abstraction that serves as a basis for all simulated processes.

Constructor & Destructor Documentation

◆ S4U_Daemon()

wrench::S4U_Daemon::S4U_Daemon ( std::string  hostname,
std::string  process_name_prefix,
std::string  mailbox_prefix 
)

Constructor (daemon with a mailbox)

Parameters
hostnamethe name of the host on which the daemon will run
process_name_prefixthe prefix of the name of the simulated process/actor
mailbox_prefixthe prefix of the mailbox (to which a unique integer is appended)

◆ ~S4U_Daemon()

wrench::S4U_Daemon::~S4U_Daemon ( )
virtual

Constructor (daemon without a mailbox)

Parameters
hostnamethe name of the host on which the daemon will run
process_name_prefixthe prefix of the name of the simulated process/actor

Member Function Documentation

◆ createLifeSaver()

void wrench::S4U_Daemon::createLifeSaver ( std::shared_ptr< S4U_Daemon reference)

Create a life saver for the daemon.

Parameters
reference

◆ getName()

std::string wrench::S4U_Daemon::getName ( )

Retrieve the process name.

Returns
the name

◆ isSetToAutoRestart()

bool wrench::S4U_Daemon::isSetToAutoRestart ( )

Return the auto-restart status of the daemon.

Returns
true or false

◆ join()

bool wrench::S4U_Daemon::join ( )

Join (i.e., wait for) the daemon.

Returns
true if the daemon terminated cleanly (i.e., main() returned), or false otherwise

◆ main()

virtual int wrench::S4U_Daemon::main ( )
pure virtual

The daemon's main method, to be overridden.

Returns
0 on success, non-0 on failure!

Implemented in wrench::CloudService, wrench::VirtualizedClusterService, wrench::WorkloadTraceFileReplayerEventReceiver, and wrench::ComputeThread.

◆ startDaemon()

void wrench::S4U_Daemon::startDaemon ( bool  daemonized,
bool  auto_restart 
)

Start the daemon.

Parameters
daemonizedwhether the S4U actor should be daemonized
auto_restartwhether the S4U actor should automatically restart after a host reboot

The documentation for this class was generated from the following files:
  • /Users/rafsilva/Documents/isi/workspace/wrench/wrench/include/wrench/simgrid_S4U_util/S4U_Daemon.h
  • /Users/rafsilva/Documents/isi/workspace/wrench/wrench/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp