Procházet zdrojové kódy

The header name and the value in event payloads are now
separated by a space instead of a line feed. The names of keys in
all event type header serializations have had underscores removed.

Chris McDonough před 18 roky
rodič
revize
2568632745

+ 3 - 2
CHANGES.txt

@@ -53,8 +53,9 @@ Next Release
     serializations now separate the data sent by the process from the
     "headers" using two linefeed characters (to make parsing easier).
     In event serialization "header" values, we've removed the space
-    between the header name and the value.  The names of keys in all
-    event types have had underscores removed.
+    between the header name and the value and headers are now
+    separated by a space instead of a line feed.  The names of keys in
+    all event types have had underscores removed.
 
 3.0a2
 

+ 4 - 8
README.txt

@@ -932,8 +932,7 @@ Supervisor Events (New in 3.0)
     The serialized body of a PROCESS_STATE_CHANGE event (and all
     subtypes) is in the form::
 
-      process_name: <name>
-      group_name: <name>
+      process_name:<name> group_name:<name> pid:<process_pid>
 
     Subtypes of PROCESS_STATE_CHANGE:
 
@@ -1004,8 +1003,7 @@ Supervisor Events (New in 3.0)
     The serialized body of a PROCESS_COMMUNICATION event (and all
     subtypes) is::
 
-      process_name: <name>
-      group_name: <name>
+      process_name:<name> group_name:<name>
       <data>
 
     Subtypes of PROCESS_COMMUNICATION:
@@ -1041,8 +1039,7 @@ Supervisor Events (New in 3.0)
     The serialization of an EVENT_BUFFER_OVERFLOW body
     is::
 
-      group_name: <name>
-      event_type: <type of discarded event>
+      group_name:<name> event_type:<type of discarded event>
 
 Event Listeners (New in 3.0)
 
@@ -1175,8 +1172,7 @@ Event Listener Notification Protocol
   specific event data serialization definitions.  An example payload
   for a PROCESS_COMMUNICATION_STDOUT event notification is::
 
-    process_name: foo
-    group_name: bar
+    process_name:foo group_name:bar pid:123
     This is the data that was sent between the tags
 
   Once it has processed the header, the event listener implementation

+ 3 - 3
src/supervisor/events.py

@@ -42,7 +42,7 @@ class EventBufferOverflowEvent(Event):
     def __str__(self):
         name = self.group.config.name
         typ = getEventNameByType(self.event)
-        return 'groupname:%s\neventtype:%s' % (name, typ)
+        return 'groupname:%s eventtype:%s' % (name, typ)
 
 class ProcessCommunicationEvent(Event):
     # event mode tokens
@@ -57,7 +57,7 @@ class ProcessCommunicationEvent(Event):
         groupname = ''
         if self.process.group is not None:
             groupname = self.process.group.config.name
-        return 'processname:%s\ngroupname:%s\npid:%s\n\n%s' % (
+        return 'processname:%s groupname:%s pid:%s\n%s' % (
             self.process.config.name,
             groupname,
             self.pid,
@@ -81,7 +81,7 @@ class ProcessStateChangeEvent(Event):
         groupname = ''
         if self.process.group is not None:
             groupname = self.process.group.config.name
-        return 'processname:%s\ngroupname:%s\npid:%s' % (
+        return 'processname:%s groupname:%s pid:%s' % (
             self.process.config.name,
             groupname,
             self.pid)

+ 2 - 2
src/supervisor/tests/test_events.py

@@ -101,7 +101,7 @@ class TestEventTypes(unittest.TestCase):
         
 class TestSerializations(unittest.TestCase):
     def _deserialize(self, serialization):
-        data = serialization.split('\n\n')
+        data = serialization.split('\n')
         headerdata = data[0]
         payload = ''
         headers = {}
@@ -110,7 +110,7 @@ class TestSerializations(unittest.TestCase):
         if headerdata:
             try:
                 headers = dict( [ x.split(':',1) for x in
-                                  headerdata.split('\n')] )
+                                  headerdata.split()] )
             except ValueError:
                 raise AssertionError('headerdata %r could not be deserialized' %
                                      headerdata)

+ 1 - 1
src/supervisor/tests/test_process.py

@@ -1282,7 +1282,7 @@ class EventListenerPoolTests(ProcessGroupBaseTests):
         header, payload = process1.stdin_buffer.split('\n', 1)
         
         self.assertEquals(payload,
-            'processname:process1\ngroupname:whatever\npid:1', payload)
+            'processname:process1 groupname:whatever pid:1', payload)
         headers = header.split()
         self.assertEqual(
             headers[5],