supervisor.getProcessInfo(namespec)
Table 2.21. supervisor.getProcessInfo() Parameters
| Type | Name | Description |
|---|---|---|
| string | namespec | Name of the group and process |
Table 2.22. supervisor.getProcessInfo() Return Value
| Type | Description |
|---|---|
| struct |
{'name': 'process name',
'group': 'group name',
'start': 1200361776,
'stop': 0,
'now': 1200361812,
'state': 1,
'statename': 'RUNNING',
'spawnerr': '',
'exitstatus': 0,
'stdout_logfile': '/path/to/stdout-log',
'stderr_logfile': '/path/to/stderr-log',
'pid': 1}
|
Returns information about a process. Supervisor maintains a table of processes under its control and can return information about them to the client at any time.
supervisor.getAllProcessInfo()
Table 2.24. supervisor.getAllProcessInfo() Return Value
| Type | Description |
|---|---|
| array | Array of structs, same as returned by supervisor.getProcessInfo(). |
supervisor.getAllProcessInfo() returns an array
containing n number of elements, where n is
the number of processes in Supervisor’s process table.
Each element contains a struct, and this
struct contains the exact same elements as the
struct returned by supervisor.getProcess(). If
the process table is empty, an empty array is returned.
supervisor.startProcess(namespec, wait=True)
Table 2.25. supervisor.startProcess() Parameters
| Type | Name | Description |
|---|---|---|
| string | namespec | Name of the group and process |
| boolean | wait | Wait for start to complete before returning? |
The supervisor.startProcess() method will start a process.
If name of the group and process (namespec argument) is
not recognized, the fault BAD_NAME will be raised.
If wait=False, the method will return immediately without
waiting for Supervisor to start the process.
If wait=True, Supervisor will attempt to start the process
and then will hold the HTTP request until the process has reached
startsecs.
If the process starts successfully, the boolean TRUE
is returned. Otherwise, the fault ABNORMAL_TERMINATION
is raised.
supervisor.startAllProcesses()
Table 2.27. supervisor.startAllProcesses() Parameters
| Type | Name | Description |
|---|---|---|
| boolean | wait | Wait for start to complete before returning? (optional, default True) |
Table 2.28. supervisor.startAllProcesses() Return Value
| Type | Description |
|---|---|
| boolean or array<struct> | See below |
This method will start all processes that are not running. It
is the equivalent of calling supervisor.startProcess() on
every process that is not running.
If wait=False, the method will return immediately without
waiting for Supervisor to start any of the processes in the group. The
return value will always be boolean True.
If wait=True, Supervisor will attempt to start every process
in the group. It will then hold the HTTP request until each process
has reached startsecs.
The return value will then be an array of structs, where each struct
contains the keys group (group name), name
(process name), description (process description), and
status (fault code).
If a process starts successfully, the status will be set
to SUCCESS. Otherwise, the fault ABNORMAL_TERMINATION
is raised.
supervisor.startProcessGroup(name, wait=True)
Table 2.29. supervisor.startProcessGroup() Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the group |
| boolean | wait | Wait for start to complete before returning? (optional, default True) |
Table 2.30. supervisor.startProcessGroup() Return Value
| Type | Description |
|---|---|
| boolean or array<struct> | See below |
The supervisor.startProcessGroup() method will start all
processes in a group. If name of the group (name argument)
is not recognized, the fault BAD_NAME will be raised.
If wait=False, the method will return immediately without
waiting for Supervisor to start any of the processes in the group. The
return value will always be boolean True.
If wait=True, Supervisor will attempt to start every process
in the group. It will then hold the HTTP request until each process
has reached startsecs.
The return value will then be an array of structs, where each struct
contains the keys group (group name), name
(process name), description (process description), and
status (fault code).
If a process starts successfully, the status will be set
to SUCCESS. Otherwise, the fault ABNORMAL_TERMINATION
is raised.
supervisor.stopProcessGroup(name)
Table 2.31. supervisor.stopProcessGroup() Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Group name to stop |
| boolean | wait | Wait for stop to complete before returning? (optional, default True) |
Table 2.32. supervisor.stopProcessGroup() Return Value
| Type | Description |
|---|---|
| boolean or array<struct> | See below |
This method will unceremoniously kill all processes within a process group. In normal operations, processes will always terminate on their own. This method will only be used to terminate runaway processes or otherwise kill a process prematurely.
If name of the group (name argument) is not recognized,
the fault BAD_NAME will be raised.
If wait=True, Supervisor hold the HTTP request until each
process has been stopped (or tries to stop have been exhausted).
The return value will then be an array of structs, where each struct
contains the keys group (group name), name
(process name), description (process description), and
status (fault code).
If any process cannot be stopped then the fault code for
FAILED will be reported in its return struct. This is
abnormal and results in Supervisor being in a potentially unstable
condition.
If wait=False, the method will return immediately without
waiting for Supervisor to stop any of the processes. The return value
will always be boolean True.
supervisor.stopProcess(namespec)
Table 2.33. supervisor.stopProcess() Parameters
| Type | Name | Description |
|---|---|---|
| string | namespec | Name of the group and process |
This method will unceremoniously kill a single process. In normal operations, processes will always terminate on their own. This method will only be used to terminate runaway processes or otherwise kill a process prematurely.
If namespec is not recognized, the fault BAD_NAME
will be raised.
If any process cannot be stopped then the fault FAILED
will be raised. This is abnormal and results in Supervisor being in a
potentially unstable condition.
If the wait argument is True, Supervisor will hold the
client’s HTTP request until the process has actually been killed. Once a
process has been killed, it will be removed from Supervisor’s process table.
supervisor.stopAllProcesses()
Table 2.35. supervisor.stopAllProcesses() Parameters
| Type | Name | Description |
|---|---|---|
| boolean | wait | Wait for stop to complete before returning? (optional, default True) |
Table 2.36. supervisor.stopAllProcesses() Return Value
| Type | Description |
|---|---|
| boolean or array<struct> | See below |
This method will unceremoniously kill all processes that are running. It
is the equivalent of calling supervisor.stopProcess() on
every running process.
If wait=True, Supervisor hold the HTTP request until each
process has been stopped (or tries to stop have been exhausted).
The return value will then be an array of structs, where each struct
contains the keys group (group name), name
(process name), description (process description), and
status (fault code).
If any process cannot be stopped then the fault code for
FAILED will be reported in its return struct. This is
abnormal and results in Supervisor being in a potentially unstable
condition.
If wait=False, the method will return immediately without
waiting for Supervisor to stop any of the processes. The return value
will always be boolean True.
supervisor.sendProcessStdin(namespec, chars)
Table 2.37. supervisor.sendProcessStdin() Parameters
| Type | Name | Description |
|---|---|---|
| string | namespec | Name of the group and process |
| string | chars | Character data to push into the process’ STDIN file descriptor |
The supervisor.sendProcessStdin() method passes a string of
characters (parameter chars) into a process'
STDIN file descriptor. Supervisor does not terminate the string in
any way; it passes the string exactly as it is given in the chars
parameter. This means that a carriage return or linefeed must be
appended to the chars string itself if one needs to be sent.
If the process named by the parameter namespec is not
known by Supervisor, a fault BAD_NAME is raised.
If the process is not running or is being killed, a fault
NOT_RUNNING is raised.
supervisor.sendRemoteCommEvent()
Table 2.39. supervisor.sendRemoteCommEvent() Parameters
| Type | Name | Description |
|---|---|---|
| string | type | Value for type in the event header |
| string | data | Value for the event payload |
The supervisor.sendRemoteCommEvent() method emits
an event that will be received by event listener subprocesses
subscribing to the REMOTE_COMMUNICATION event type.
supervisor.addProcessGroup(namespec)
Table 2.41. supervisor.addProcessGroup() Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the group |
The supervisor.addProcessGroup() reads a process group's
config from the supervisord.conf file and adds the process group if it
hasn't already been added (or if it has been removed). It automatically
starts the process group if it is set to autostart.
If the process group named by the parameter name is not
known by Supervisor, a fault BAD_NAME is raised.
If the process group is already active, an ALREADY_ADDED
is raised.
supervisor.removeProcessGroup(namespec)
Table 2.43. supervisor.removeProcessGroup() Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the group |
The supervisor.removeProcess() removes a process group
from the supervisord runtime configuration.
If the process group named by the parameter name is not
known by Supervisor, a fault BAD_NAME is raised.
If the process group is not yet stopped, a STILL_RUNNING
is raised.
