##// END OF EJS Templates
Add a metadata attribute to zeromq stdout/stderr stream messages
Jason Grout -
Show More
@@ -28,10 +28,15 b' class OutStream(object):'
28 self.name = name
28 self.name = name
29 self.parent_header = {}
29 self.parent_header = {}
30 self._new_buffer()
30 self._new_buffer()
31 self.metadata = {}
31
32
32 def set_parent(self, parent):
33 def set_parent(self, parent):
33 self.parent_header = extract_header(parent)
34 self.parent_header = extract_header(parent)
34
35
36 def set_metadata(self, metadata):
37 self.flush()
38 self.metadata = metadata
39
35 def close(self):
40 def close(self):
36 self.pub_socket = None
41 self.pub_socket = None
37
42
@@ -43,6 +48,8 b' class OutStream(object):'
43 data = self._buffer.getvalue()
48 data = self._buffer.getvalue()
44 if data:
49 if data:
45 content = {u'name':self.name, u'data':data}
50 content = {u'name':self.name, u'data':data}
51 if self.metadata:
52 content['metadata'] = self.metadata
46 msg = self.session.send(self.pub_socket, u'stream', content=content,
53 msg = self.session.send(self.pub_socket, u'stream', content=content,
47 parent=self.parent_header, ident=self.topic)
54 parent=self.parent_header, ident=self.topic)
48
55
General Comments 0
You need to be logged in to leave comments. Login now