Show More
@@ -854,9 +854,8 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'] | |
@@ -864,6 +863,11 b' class Client(HasTraits):' | |||||
864 | header = msg['header'] |
|
863 | header = msg['header'] | |
865 | msg_type = msg['header']['msg_type'] |
|
864 | msg_type = msg['header']['msg_type'] | |
866 |
|
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 | |||
|
870 | ||||
867 | # init metadata: |
|
871 | # init metadata: | |
868 | md = self.metadata[msg_id] |
|
872 | md = self.metadata[msg_id] | |
869 |
|
873 |
@@ -855,14 +855,13 b' class Hub(SessionFactory):' | |||||
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 = |
|
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] |
|
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': | |
@@ -881,8 +880,18 b' class Hub(SessionFactory):' | |||||
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 |
|
|
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