##// 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 854 if self.debug:
855 855 pprint(msg)
856 856 parent = msg['parent_header']
857 # ignore IOPub messages with no parent.
858 # Caused by print statements or warnings from before the first execution.
859 if not parent:
857 if not parent or parent['session'] != self.session.session:
858 # ignore IOPub messages not from here
860 859 idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
861 860 continue
862 861 msg_id = parent['msg_id']
863 862 content = msg['content']
864 863 header = msg['header']
865 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 871 # init metadata:
868 872 md = self.metadata[msg_id]
@@ -850,19 +850,18 b' class Hub(SessionFactory):'
850 850 msg_id = parent['msg_id']
851 851 msg_type = msg['header']['msg_type']
852 852 content = msg['content']
853
853
854 854 # ensure msg_id is in db
855 855 try:
856 856 rec = self.db.get_record(msg_id)
857 857 except KeyError:
858 rec = empty_record()
859 rec['msg_id'] = msg_id
860 self.db.add_record(msg_id, rec)
858 rec = None
859
861 860 # stream
862 861 d = {}
863 862 if msg_type == 'stream':
864 863 name = content['name']
865 s = rec[name] or ''
864 s = '' if rec is None else rec[name]
866 865 d[name] = s + content['data']
867 866
868 867 elif msg_type == 'error':
@@ -880,9 +879,19 b' class Hub(SessionFactory):'
880 879
881 880 if not d:
882 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 893 try:
885 self.db.update_record(msg_id, d)
894 update_record(msg_id, d)
886 895 except Exception:
887 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