|
@@ -47,7 +47,7 @@ listeners in Python slightly easier than in other languages.
|
|
|
|
|
|
Configuring an Event Listener
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
-
|
|
|
+
|
|
|
A supervisor event listener is specified via a ``[eventlistener:x]``
|
|
|
section in the configuration file. Supervisor ``[eventlistener:x]``
|
|
|
sections are treated almost exactly like supervisor ``[program:x]``
|
|
@@ -63,7 +63,7 @@ sections that can be placed into the configuration file.
|
|
|
When an ``[eventlistener:x]`` section is defined, it actually defines
|
|
|
a "pool", where the number of event listeners in the pool is
|
|
|
determined by the ``numprocs`` value within the section.
|
|
|
-
|
|
|
+
|
|
|
The ``events`` parameter of the ``[eventlistener:x]`` section
|
|
|
specifies the events that will be sent to a listener pool. A
|
|
|
well-written event listener will ignore events that it cannot process,
|
|
@@ -104,7 +104,7 @@ pools which are subscribed to receive events for the event's type
|
|
|
(filtered by the ``events`` value in the eventlistener
|
|
|
section) will be found. One of the listeners in each listener pool
|
|
|
will receive the event notification (any "available" listener).
|
|
|
-
|
|
|
+
|
|
|
Every process in an event listener pool is treated equally by
|
|
|
supervisor. If a process in the pool is unavailable (because it is
|
|
|
already processing an event, because it has crashed, or because it has
|
|
@@ -130,7 +130,7 @@ away the oldest event in the buffer and log an error.
|
|
|
|
|
|
Writing an Event Listener
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
-
|
|
|
+
|
|
|
An event listener implementation is a program that is willing to
|
|
|
accept structured input on its stdin stream and produce structured
|
|
|
output on its stdout stream. An event listener implementation should
|
|
@@ -169,17 +169,17 @@ server The identifier of the supervisord sending the
|
|
|
serial An integer assigned to each event. No two 30
|
|
|
events generated during the lifetime of
|
|
|
a :program:`supervisord` process will have
|
|
|
- the same serial number. The value is useful
|
|
|
+ the same serial number. The value is useful
|
|
|
for functional testing and detecting event
|
|
|
ordering anomalies.
|
|
|
pool The name of the event listener pool which myeventpool
|
|
|
generated this event.
|
|
|
pooolserial An integer assigned to each event by the 30
|
|
|
eventlistener pool which it is being sent
|
|
|
- from. No two events generated by the same
|
|
|
+ from. No two events generated by the same
|
|
|
eventlister pool during the lifetime of a
|
|
|
:program:`supervisord` process will have the
|
|
|
- same ``poolserial`` number. This value can
|
|
|
+ same ``poolserial`` number. This value can
|
|
|
be used to detect event ordering anomalies.
|
|
|
eventname The specific event type name (see TICK_5
|
|
|
:ref:`event_types`)
|
|
@@ -190,7 +190,7 @@ len An integer indicating the number of bytes in 22
|
|
|
An example of a complete header line is as follows.
|
|
|
|
|
|
.. code-block:: text
|
|
|
-
|
|
|
+
|
|
|
ver:3.0 server:supervisor serial:21 pool:listener poolserial:10 eventname:PROCESS_COMMUNICATION_STDOUT len:54
|
|
|
|
|
|
Directly following the linefeed character in the header is the event
|
|
@@ -305,7 +305,7 @@ stderr, and responds with an ``OK`` result, and then subsequently a
|
|
|
def main():
|
|
|
while 1:
|
|
|
write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
|
|
|
- line = sys.stdin.readline() # read header line from stdin
|
|
|
+ line = sys.stdin.readline() # read header line from stdin
|
|
|
write_stderr(line) # print it out to stderr
|
|
|
headers = dict([ x.split(':') for x in line.split() ])
|
|
|
data = sys.stdin.read(int(headers['len'])) # read the event payload
|
|
@@ -373,7 +373,7 @@ with space-separated tokens. Each token represents a key-value pair.
|
|
|
The key and value are separated by a colon. For example:
|
|
|
|
|
|
.. code-block:: text
|
|
|
-
|
|
|
+
|
|
|
processname:cat groupname:cat from_state:STOPPED
|
|
|
|
|
|
Token sets do not have a linefeed or carriage return character at
|
|
@@ -424,7 +424,7 @@ include additional key/value pairs in the token set.
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
-Indicates a process has moved from a state to the STARTING state.
|
|
|
+Indicates a process has moved from a state to the STARTING state.
|
|
|
|
|
|
*Name*: ``PROCESS_STATE_STARTING``
|
|
|
|
|
@@ -864,7 +864,7 @@ receive event notifications of all the subtypes of
|
|
|
``PROCESS_GROUP_ADDED`` Event Type
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
-Indicates that a process group has been added to Supervisor's configuration.
|
|
|
+Indicates that a process group has been added to Supervisor's configuration.
|
|
|
|
|
|
*Name*: ``PROCESS_GROUP_ADDED``
|
|
|
|
|
@@ -879,7 +879,7 @@ Indicates that a process group has been added to Supervisor's configuration.
|
|
|
``PROCESS_GROUP_REMOVED`` Event Type
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
-Indicates that a process group has been removed from Supervisor's configuration.
|
|
|
+Indicates that a process group has been removed from Supervisor's configuration.
|
|
|
|
|
|
*Name*: ``PROCESS_GROUP_REMOVED``
|
|
|
|