2017 © Pedro Peláez
 

library supervisor-xml-rpc

Simple Supervisor XML RPC Client in PHP (http://supervisord.org)

image

ihor/supervisor-xml-rpc

Simple Supervisor XML RPC Client in PHP (http://supervisord.org)

  • Tuesday, January 26, 2016
  • by ihor
  • Repository
  • 1 Watchers
  • 14 Stars
  • 18,337 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 3 Versions
  • 10 % Grown

The README.md

Supervisor

PHP XML RPC Client for Supervisor, (*1)

Installation

Define the following requirement in your composer.json file:, (*2)

"require": {
    "ihor/supervisor-xml-rpc": "~0.2"
}

It also requires PHP XML-RPC extension. The version is marked as dev because I haven't heard any feedback from other users., (*3)

Usage

// Create Supervisor API instance
$api = new \Supervisor\Api('127.0.0.1', 9001 /* username, password */);

// Call Supervisor API
$api->getApiVersion();

// That's all!

Reference

getApiVersion()

Returns the version of the RPC API used by supervisord, (*4)

This API is versioned separately from Supervisor itself. The API version returned by getAPIVersion only changes when the API changes. Its purpose is to help the client identify with which version of the Supervisor API it is communicating., (*5)

When writing software that communicates with this API, it is highly recommended that you first test the API version for compatibility before making method calls., (*6)

getAPIVersion, (*7)

getSupervisorVersion()

Returns the version of the supervisor package in use by supervisord, (*8)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.getSupervisorVersion, (*9)

getIdentification()

Returns identifying string of supervisord, (*10)

This method allows the client to identify with which Supervisor instance it is communicating in the case of environments where multiple Supervisors may be running., (*11)

The identification is a string that must be set in Supervisor’s configuration file. This method simply returns that value back to the client., (*12)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.getIdentification, (*13)

getState()

Returns current state of supervisord as a struct, (*14)

This is an internal value maintained by Supervisor that determines what Supervisor believes to be its current operational state., (*15)

Some method calls can alter the current state of the Supervisor. For example, calling the method supervisor.shutdown() while the station is in the RUNNING state places the Supervisor in the SHUTDOWN state while it is shutting down., (*16)

The supervisor.getState() method provides a means for the client to check Supervisor’s state, both for informational purposes and to ensure that the methods it intends to call will be permitted., (*17)

The return value is a struct:, (*18)

The possible return values are:, (*19)

Code Name Description
2 FATAL Supervisor has experienced a serious error.
1 RUNNING Supervisor is working normally.
0 RESTARTING Supervisor is in the process of restarting.
-1 SHUTDOWN Supervisor is in the process of shutting down.

The FATAL state reports unrecoverable errors, such as internal errors inside Supervisor or system runaway conditions. Once set to FATAL, the Supervisor can never return to any other state without being restarted., (*20)

In the FATAL state, all future methods except supervisor.shutdown() and supervisor.restart() will automatically fail without being called and the fault FATAL_STATE will be raised., (*21)

In the SHUTDOWN or RESTARTING states, all method calls are ignored and their possible return values are undefined., (*22)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.getState, (*23)

getPid()

Returns the PID of supervisord, (*24)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.getPID, (*25)

readLog($offset, $length)

Reads length bytes from the main log starting at offset, (*26)

It can either return the entire log, a number of characters from the tail of the log, or a slice of the log specified by the offset and length parameters:, (*27)

Offset Length Behavior of readProcessLog
Negative Not Zero Bad arguments. This will raise the fault BAD_ARGUMENTS.
Negative Zero This will return the tail of the log, or offset number of characters from the end of the log. For example, if offset = -4 and length = 0, then the last four characters will be returned from the end of the log.
Zero or Positive Negative Bad arguments. This will raise the fault BAD_ARGUMENTS.
Zero or Positive Zero All characters will be returned from the offset specified.
Zero or Positive Positive A number of characters length will be returned from the offset.

If the log is empty and the entire log is requested, an empty string is returned. If either offset or length is out of range, the fault BAD_ARGUMENTS will be returned. If the log cannot be read, this method will raise either the NO_FILE error if the file does not exist or the FAILED error if any other problem was encountered., (*28)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.readLog, (*29)

clearLog()

Clears the main log, (*30)

If the log cannot be cleared because the log file does not exist, the fault NO_FILE will be raised. If the log cannot be cleared for any other reason, the fault FAILED will be raised., (*31)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.clearLog, (*32)

shutdown()

Shuts down the supervisor process, (*33)

This method shuts down the Supervisor daemon. If any processes are running, they are automatically killed without warning. Unlike most other methods, if Supervisor is in the FATAL state, this method will still function., (*34)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.shutdown, (*35)

restart()

Restarts the supervisor process, (*36)

This method soft restarts the Supervisor daemon. If any processes are running, they are automatically killed without warning. Note that the actual UNIX process for Supervisor cannot restart; only Supervisor’s main program loop. This has the effect of resetting the internal states of Supervisor., (*37)

Unlike most other methods, if Supervisor is in the FATAL state, this method will still function., (*38)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.restart, (*39)

getProcessInfo($name)

Returns info about a process named name, (*40)

The return value is a struct:, (*41)

{'name':           'process name',
 'group':          'group name',
 'description':    'pid 18806, uptime 0:03:12'
 'start':          1200361776,
 'stop':           0,
 'now':            1200361812,
 'state':          1,
 'statename':      'RUNNING',
 'spawnerr':       '',
 'exitstatus':     0,
 'logfile':        '/path/to/stdout-log', # deprecated, b/c only
 'stdout_logfile': '/path/to/stdout-log',
 'stderr_logfile': '/path/to/stderr-log',
 'pid':            1}

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.getProcessInfo, (*42)

getAllProcessInfo()

Returns info about all processes, (*43)

Each element contains a struct, and this struct contains the exact same elements as the struct returned by getProcess. If the process table is empty, an empty array is returned., (*44)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.getAllProcessInfo, (*45)

startProcess($name, $wait = true)

Starts a process, (*46)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.startProcess, (*47)

stopProcess($name, $wait = true)

Stops a process named by name, (*48)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.stopProcess, (*49)

startProcessGroup($name, $wait = true)

Starts all processes in the group named by name, (*50)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.startProcessGroup, (*51)

stopProcessGroup($name, $wait = true)

Stops all processes in the process group named by name, (*52)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.stopProcessGroup, (*53)

startAllProcesses($wait = true)

Starts all processes listed in the configuration file, (*54)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.startAllProcesses, (*55)

stopAllProcesses($wait = true)

Stops all processes in the process list, (*56)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.stopAllProcesses, (*57)

sendProcessStdin($name, $chars)

Sends a string of chars to the stdin of the process name., (*58)

If non-7-bit data is sent (unicode), it is encoded to utf-8 before being sent to the process’ stdin. If chars i not a string or is not unicode, raise INCORRECT_PARAMETERS. If the process is not running, raise NOT_RUNNING. If the process’ stdin cannot accept input (e.g. it was closed by the child process), raise NO_FILE., (*59)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.sendProcessStdin, (*60)

sendRemoteCommEvent($type, $data)

Sends an event that will be received by event listener subprocesses subscribing to the RemoteCommunicationEvent., (*61)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.sendRemoteCommEvent, (*62)

addProcessGroup($name)

Updates the config for a running process from config file., (*63)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.addProcessGroup, (*64)

removeProcessGroup($name)

Removes a stopped process from the active configuration, (*65)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.removeProcessGroup, (*66)

readProcessStdoutLog($name, $offset, $length)

Reads length bytes from name’s stdout log starting at offset, (*67)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.readProcessStdoutLog, (*68)

readProcessStderrLog($name, $offset, $length)

Read length bytes from name’s stderr log starting at offset, (*69)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.tailProcessStderrLog, (*70)

tailProcessStdoutLog($name, $offset, $length)

Provides a more efficient way to tail the (stdout) log than readProcessStdoutLog(). Use readProcessStdoutLog() to read chunks and tailProcessStdoutLog() to tail., (*71)

Requests (length) bytes from the (name)’s log, starting at (offset). If the total log size is greater than (offset + length), the overflow flag is set and the (offset) is automatically increased to position the buffer at the end of the log. If less than (length) bytes are available, the maximum number of available bytes will be returned. (offset) returned is always the last offset in the log +1., (*72)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.tailProcessStdoutLog, (*73)

tailProcessStderrLog($name, $offset, $length)

Provides a more efficient way to tail the (stderr) log than readProcessStderrLog(). Use readProcessStderrLog() to read chunks and tailProcessStderrLog() to tail., (*74)

Requests (length) bytes from the (name)’s log, starting at (offset). If the total log size is greater than (offset + length), the overflow flag is set and the (offset) is automatically increased to position the buffer at the end of the log. If less than (length) bytes are available, the maximum number of available bytes will be returned. (offset) returned is always the last offset in the log +1., (*75)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.tailProcessStderrLog, (*76)

clearProcessLogs($name)

Clears the stdout and stderr logs for the named process and reopen them, (*77)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.clearProcessLogs, (*78)

clearAllProcessLogs()

Clears all process log files, (*79)

http://supervisord.org/api.html#supervisor.rpcinterface.SupervisorNamespaceRPCInterface.clearAllProcessLogs, (*80)

listMethods()

Returns an array listing the available method names, (*81)

http://supervisord.org/api.html#supervisor.xmlrpc.SystemNamespaceRPCInterface.listMethods, (*82)

methodHelp($name)

Returns a string showing the method’s documentation, (*83)

http://supervisord.org/api.html#supervisor.xmlrpc.SystemNamespaceRPCInterface.methodHelp, (*84)

methodSignature($name)

Returns an array describing the method signature in the form [rtype, ptype, ptype...] where rtype is the return data type of the method, and ptypes are the parameter data types that the method accepts in method argument order., (*85)

http://supervisord.org/api.html#supervisor.xmlrpc.SystemNamespaceRPCInterface.methodSignature, (*86)

multicall(array $calls)

Processes an array of calls, and return an array of results. Calls should be structs of the form. Each result will either be a single-item array containg the result value, or a struct of the form . This is useful when you need to make lots of small calls without lots of round trips., (*87)

http://supervisord.org/api.html#supervisor.xmlrpc.SystemNamespaceRPCInterface.multicall, (*88)

The Versions

26/01 2016

dev-master

9999999-dev

Simple Supervisor XML RPC Client in PHP (http://supervisord.org)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Ihor Burlachenko

api supervisor supervisord xml-rpc supervisorctl

11/01 2016

0.1.1

0.1.1.0

Simple PHP XML RPC Client for Supervisor (http://supervisord.org)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Ihor Burlachenko

api supervisor supervisord xml-rpc supervisorctl

12/08 2015

0.1

0.1.0.0

PHP XML RPC Client for Supervisor (http://supervisord.org)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Ihor Burlachenko