Show More
@@ -854,9 +854,8 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'] |
@@ -864,6 +863,11 b' class Client(HasTraits):' | |||
|
864 | 863 | header = msg['header'] |
|
865 | 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 | 871 | # init metadata: |
|
868 | 872 | md = self.metadata[msg_id] |
|
869 | 873 |
@@ -855,14 +855,13 b' class Hub(SessionFactory):' | |||
|
855 | 855 | try: |
|
856 | 856 | rec = self.db.get_record(msg_id) |
|
857 | 857 | except KeyError: |
|
858 |
rec = |
|
|
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] |
|
|
864 | s = '' if rec is None else rec[name] | |
|
866 | 865 | d[name] = s + content['data'] |
|
867 | 866 | |
|
868 | 867 | elif msg_type == 'error': |
@@ -881,8 +880,18 b' class Hub(SessionFactory):' | |||
|
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 |
|
|
|
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