Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
Mads::UpSupervisor Class Reference

Starts, supervises and tears down the processes described by an expanded Mads::DirectorConfig. Foreground-only by design (see NEW_FEATURES.md P5): one call to run() drives the whole lifecycle and blocks until teardown completes. More...

#include <up_supervisor.hpp>

Public Member Functions

 UpSupervisor (std::vector< ProcessConfig > processes, UpOptions options)
 
 ~UpSupervisor ()
 
 UpSupervisor (const UpSupervisor &)=delete
 
UpSupervisoroperator= (const UpSupervisor &)=delete
 
RunResult run ()
 Starts every enabled process in order (waiting on each one's ready probe before moving on to whatever depends on it), then monitors until a stop is requested (request_stop(), –until-exit's target exiting, –timeout elapsing, or a non-relaunch process dying with a non-zero exit code), then tears everything down in reverse start order. Blocking; safe to call exactly once per instance.
 
void request_stop ()
 
bool stop_requested () const
 True once request_stop() was called or run() decided to stop on its own.
 
int start_count (const std::string &name) const
 
bool any_running () const
 

Detailed Description

Starts, supervises and tears down the processes described by an expanded Mads::DirectorConfig. Foreground-only by design (see NEW_FEATURES.md P5): one call to run() drives the whole lifecycle and blocks until teardown completes.

Definition at line 83 of file up_supervisor.hpp.

Constructor & Destructor Documentation

◆ UpSupervisor() [1/2]

Mads::UpSupervisor::UpSupervisor ( std::vector< ProcessConfig processes,
UpOptions  options 
)

◆ ~UpSupervisor()

Mads::UpSupervisor::~UpSupervisor ( )

◆ UpSupervisor() [2/2]

Mads::UpSupervisor::UpSupervisor ( const UpSupervisor )
delete

Member Function Documentation

◆ any_running()

bool Mads::UpSupervisor::any_running ( ) const

True if any managed process is currently running. Used after run() returns to assert teardown left no orphans.

◆ operator=()

UpSupervisor & Mads::UpSupervisor::operator= ( const UpSupervisor )
delete

◆ request_stop()

void Mads::UpSupervisor::request_stop ( )

Thread-safe. Asks a running (or not-yet-started) supervisor to begin teardown at the next opportunity. Intended to be called from a signal handler installed by main().

◆ run()

RunResult Mads::UpSupervisor::run ( )

Starts every enabled process in order (waiting on each one's ready probe before moving on to whatever depends on it), then monitors until a stop is requested (request_stop(), –until-exit's target exiting, –timeout elapsing, or a non-relaunch process dying with a non-zero exit code), then tears everything down in reverse start order. Blocking; safe to call exactly once per instance.

◆ start_count()

int Mads::UpSupervisor::start_count ( const std::string &  name) const

Number of times the named process instance has been started (1 after the first start, 2 after one relaunch, ...). 0 if never started/unknown.

◆ stop_requested()

bool Mads::UpSupervisor::stop_requested ( ) const

True once request_stop() was called or run() decided to stop on its own.


The documentation for this class was generated from the following file: