DSSX_ProcessManager
DSSX_ProcessManager
dssx
1998 12-06
CLASS
DSSX_ProcessManager - provides process control
SYNOPSIS
This class provides distributed process control using DSS.
Specific numbers of specific processes may be maintained through this
construct.
PROCESS CONTROL ALGORITHM
The process manager consists of a table of DSSX_ProcessEntry objects (currently
implemented as a DSSX_Bag).
The tracking of processes is based on the behavior of the DSS
STARTWRITE/STOPWRITE operations. When a tracked process registers with
process control it is basicly doing a STARTWRITE on a chunk with a unique name.
At this point the chunk exists in the process control space in a WAITING state.
When a process gracefully deregisters it does a STOPWRITE which causes the
chunk to go into a VALID state. If a process dies ungracefully (without
deregistering) the chunk is automatically goes into an INVALID state and is
eventually garbage collected. Therefore, the state of the chunk corresponding
to a process indicates the state of the process as follows:
| WAITING |
process is alive
|
| VALID |
process has exited gracefully
|
| INVALID |
process has died ungracefully
|
| non-existent |
process has died ungracefully
|
The DSSX_ProcessManager object uses this information to perform its operations.
For example, the Check() call updates the number alive and
number gracefully exited fields of the process tuples based on the chunk
states.
CONSTRUCTOR
DSSX_ProcessManager(DSSX_Connection *connection, const GPL_CharPtr &space, const GPL_CharPtr &manager, DSS_ChunkConfig *config)
A valid open connection must be specified with connection. The space
specified by space must also already exist. Note that any host on which
processes are to be managed must also be JOINed into the space. The name
of the DSSX_ProcessManager is specified by manager. The configuration
of the underlying DSS chunks is specified by config.
MEMBER FUNCTIONS
GPL_Boolean Clear(void)
Clear all process entry tuples.
GPL_Boolean Load(const GPL_String &filename)
Load process entry tuples from a file with the name filename. The process
entries are added and pre-existing tuple are not automatically cleared. The
format of the file is one line per process type. Each line is a colon
separated list o ffields as follows:
process_name:quantity to be run:retries before giving up:hostname to run on:command line to execute
GPL_Boolean Add(DSSX_ProcessEntry &pentry)
Add a process entry as specified by pentry.
GPL_Boolean Add(GPL_List<DSSX_ProcessEntry> &plist)
Add process entries as specified by plist.
GPL_Boolean Remove(const GPL_String &name)
Remove the process entry with a process name of name.
GPL_Boolean Check()
Update the process entries based on current process state information.
GPL_Boolean Fill(const GPL_String &username,const GPL_String &password)
Attempt to spawn processes to bring the running configuration up to what is
specified by the process entries.
GPL_Boolean Preen()
Attempt to kill processes to bring the running configuration down to what is
specified by the process entries.
GPL_Boolean GetPidList(GPL_List<OSD_PID> &alive, GPL_List<OSD_PID> &dead, const GPL_String &name)
Get a list of pids for all alive and dead (gracefully exitted) processes
running under process control with as name.
void GetList(GPL_List<DSSX_ProcessEntry> &plist)
Get a list of all the process entries.
void TestDump()
Print a dump of the process entries. This is intended for debugging purposes.
VIRTUAL MEMBER FUNCTIONS
These functions are to provide a developer hooks with which to extend the
funtionality of DSSX_ProcessManager.
void WhenAdd(DSSX_ProcessEntry &pentry)
This function is called when pentry has been added to the table.
void WhenRemove(DSSX_ProcessEntry &pentry)
This function is called when pentry has been removed from the table.
void WhenModify(DSSX_ProcessEntry &pentry)
This function is called when pentry has been modified (usually within a
call to Check.