##// END OF EJS Templates
Merge pull request #6146 from minrk/parallel-handle-status...
Thomas Kluyver -
r17267:48531b99 merge
parent child Browse files
Show More
@@ -854,15 +854,19 b' class Client(HasTraits):'
854 if self.debug:
854 if self.debug:
855 pprint(msg)
855 pprint(msg)
856 parent = msg['parent_header']
856 parent = msg['parent_header']
857 # ignore IOPub messages with no parent.
857 if not parent or parent['session'] != self.session.session:
858 # Caused by print statements or warnings from before the first execution.
858 # ignore IOPub messages not from here
859 if not parent:
860 idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
859 idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
861 continue
860 continue
862 msg_id = parent['msg_id']
861 msg_id = parent['msg_id']
863 content = msg['content']
862 content = msg['content']
864 header = msg['header']
863 header = msg['header']
865 msg_type = msg['header']['msg_type']
864 msg_type = msg['header']['msg_type']
865
866 if msg_type == 'status' and msg_id not in self.metadata:
867 # ignore status messages if they aren't mine
868 idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
869 continue
866
870
867 # init metadata:
871 # init metadata:
868 md = self.metadata[msg_id]
872 md = self.metadata[msg_id]
@@ -850,19 +850,18 b' class Hub(SessionFactory):'
850 msg_id = parent['msg_id']
850 msg_id = parent['msg_id']
851 msg_type = msg['header']['msg_type']
851 msg_type = msg['header']['msg_type']
852 content = msg['content']
852 content = msg['content']
853
853
854 # ensure msg_id is in db
854 # ensure msg_id is in db
855 try:
855 try:
856 rec = self.db.get_record(msg_id)
856 rec = self.db.get_record(msg_id)
857 except KeyError:
857 except KeyError:
858 rec = empty_record()
858 rec = None
859 rec['msg_id'] = msg_id
859
860 self.db.add_record(msg_id, rec)
861 # stream
860 # stream
862 d = {}
861 d = {}
863 if msg_type == 'stream':
862 if msg_type == 'stream':
864 name = content['name']
863 name = content['name']
865 s = rec[name] or ''
864 s = '' if rec is None else rec[name]
866 d[name] = s + content['data']
865 d[name] = s + content['data']
867
866
868 elif msg_type == 'error':
867 elif msg_type == 'error':
@@ -880,9 +879,19 b' class Hub(SessionFactory):'
880
879
881 if not d:
880 if not d:
882 return
881 return
883
882
883 if rec is None:
884 # new record
885 rec = empty_record()
886 rec['msg_id'] = msg_id
887 rec.update(d)
888 d = rec
889 update_record = self.db.add_record
890 else:
891 update_record = self.db.update_record
892
884 try:
893 try:
885 self.db.update_record(msg_id, d)
894 update_record(msg_id, d)
886 except Exception:
895 except Exception:
887 self.log.error("DB Error saving iopub message %r", msg_id, exc_info=True)
896 self.log.error("DB Error saving iopub message %r", msg_id, exc_info=True)
888
897
General Comments 0
You need to be logged in to leave comments. Login now