Show More
@@ -58,8 +58,8 b' def serialize_binary_message(msg):' | |||
|
58 | 58 | return b''.join(buffers) |
|
59 | 59 | |
|
60 | 60 | |
|
61 |
def |
|
|
62 |
""" |
|
|
61 | def deserialize_binary_message(bmsg): | |
|
62 | """deserialize a message from a binary blog | |
|
63 | 63 | |
|
64 | 64 | Header: |
|
65 | 65 | |
@@ -133,13 +133,13 b' class ZMQStreamHandler(websocket.WebSocketHandler):' | |||
|
133 | 133 | def _reserialize_reply(self, msg_list): |
|
134 | 134 | """Reserialize a reply message using JSON. |
|
135 | 135 | |
|
136 |
This takes the msg list from the ZMQ socket, |
|
|
136 | This takes the msg list from the ZMQ socket, deserializes it using | |
|
137 | 137 | self.session and then serializes the result using JSON. This method |
|
138 | 138 | should be used by self._on_zmq_reply to build messages that can |
|
139 | 139 | be sent back to the browser. |
|
140 | 140 | """ |
|
141 | 141 | idents, msg_list = self.session.feed_identities(msg_list) |
|
142 |
msg = self.session. |
|
|
142 | msg = self.session.deserialize(msg_list) | |
|
143 | 143 | try: |
|
144 | 144 | msg['header'].pop('date') |
|
145 | 145 | except KeyError: |
@@ -110,7 +110,7 b' class ZMQChannelHandler(AuthenticatedZMQStreamHandler):' | |||
|
110 | 110 | """ |
|
111 | 111 | idents,msg = self.session.feed_identities(msg) |
|
112 | 112 | try: |
|
113 |
msg = self.session. |
|
|
113 | msg = self.session.deserialize(msg) | |
|
114 | 114 | except: |
|
115 | 115 | self.log.error("Bad kernel_info reply", exc_info=True) |
|
116 | 116 | self._request_kernel_info() |
@@ -846,8 +846,9 b' define([' | |||
|
846 | 846 | } |
|
847 | 847 | }; |
|
848 | 848 | |
|
849 | Kernel.prototype._unserialize_binary_message = function(blob, callback) { | |
|
850 | // unserialize the binary message format | |
|
849 | ||
|
850 | Kernel.prototype._deserialize_binary_message = function(blob, callback) { | |
|
851 | // deserialize the binary message format | |
|
851 | 852 | // callback will be called with a message whose buffers attribute |
|
852 | 853 | // will be an array of DataViews. |
|
853 | 854 | var reader = new FileReader(); |
@@ -880,14 +881,14 b' define([' | |||
|
880 | 881 | }; |
|
881 | 882 | |
|
882 | 883 | |
|
883 |
Kernel.prototype._ |
|
|
884 |
// |
|
|
884 | Kernel.prototype._deserialize_msg = function (e, callback) { | |
|
885 | // deserialze a message and pass the unpacked message object to callback | |
|
885 | 886 | if (typeof e.data === "string") { |
|
886 | 887 | // text JSON message |
|
887 | 888 | callback($.parseJSON(e.data)); |
|
888 | 889 | } else { |
|
889 | 890 | // binary message |
|
890 |
this._ |
|
|
891 | this._deserialize_binary_message(e.data, callback); | |
|
891 | 892 | } |
|
892 | 893 | }; |
|
893 | 894 | |
@@ -895,7 +896,7 b' define([' | |||
|
895 | 896 | * @function _handle_shell_reply |
|
896 | 897 | */ |
|
897 | 898 | Kernel.prototype._handle_shell_reply = function (e) { |
|
898 |
this._ |
|
|
899 | this._deserialize_msg(e, $.proxy(this._finish_shell_reply, this)); | |
|
899 | 900 | }; |
|
900 | 901 | |
|
901 | 902 | Kernel.prototype._finish_shell_reply = function (reply) { |
@@ -1026,7 +1027,7 b' define([' | |||
|
1026 | 1027 | * @function _handle_iopub_message |
|
1027 | 1028 | */ |
|
1028 | 1029 | Kernel.prototype._handle_iopub_message = function (e) { |
|
1029 |
this._ |
|
|
1030 | this._deserialize_msg(e, $.proxy(this._finish_iopub_message, this)); | |
|
1030 | 1031 | }; |
|
1031 | 1032 | |
|
1032 | 1033 | |
@@ -1041,7 +1042,7 b' define([' | |||
|
1041 | 1042 | * @function _handle_input_request |
|
1042 | 1043 | */ |
|
1043 | 1044 | Kernel.prototype._handle_input_request = function (e) { |
|
1044 |
this._ |
|
|
1045 | this._deserialize_msg(e, $.proxy(this._finish_input_request, this)); | |
|
1045 | 1046 | }; |
|
1046 | 1047 | |
|
1047 | 1048 |
@@ -176,7 +176,7 b' class ZMQSocketChannel(Thread):' | |||
|
176 | 176 | Unpacks message, and calls handlers with it. |
|
177 | 177 | """ |
|
178 | 178 | ident,smsg = self.session.feed_identities(msg) |
|
179 |
msg = self.session. |
|
|
179 | msg = self.session.deserialize(smsg) | |
|
180 | 180 | self.call_handlers(msg) |
|
181 | 181 | |
|
182 | 182 |
@@ -130,7 +130,7 b' class Kernel(SingletonConfigurable):' | |||
|
130 | 130 | """dispatch control requests""" |
|
131 | 131 | idents,msg = self.session.feed_identities(msg, copy=False) |
|
132 | 132 | try: |
|
133 |
msg = self.session. |
|
|
133 | msg = self.session.deserialize(msg, content=True, copy=False) | |
|
134 | 134 | except: |
|
135 | 135 | self.log.error("Invalid Control Message", exc_info=True) |
|
136 | 136 | return |
@@ -165,7 +165,7 b' class Kernel(SingletonConfigurable):' | |||
|
165 | 165 | |
|
166 | 166 | idents,msg = self.session.feed_identities(msg, copy=False) |
|
167 | 167 | try: |
|
168 |
msg = self.session. |
|
|
168 | msg = self.session.deserialize(msg, content=True, copy=False) | |
|
169 | 169 | except: |
|
170 | 170 | self.log.error("Invalid Message", exc_info=True) |
|
171 | 171 | return |
@@ -89,7 +89,7 b' def serialize_object(obj, buffer_threshold=MAX_BYTES, item_threshold=MAX_ITEMS):' | |||
|
89 | 89 | buffers.insert(0, pickle.dumps(cobj, PICKLE_PROTOCOL)) |
|
90 | 90 | return buffers |
|
91 | 91 | |
|
92 |
def |
|
|
92 | def deserialize_object(buffers, g=None): | |
|
93 | 93 | """reconstruct an object serialized by serialize_object from data buffers. |
|
94 | 94 | |
|
95 | 95 | Parameters |
@@ -170,14 +170,14 b' def unpack_apply_message(bufs, g=None, copy=True):' | |||
|
170 | 170 | |
|
171 | 171 | args = [] |
|
172 | 172 | for i in range(info['nargs']): |
|
173 |
arg, arg_bufs = |
|
|
173 | arg, arg_bufs = deserialize_object(arg_bufs, g) | |
|
174 | 174 | args.append(arg) |
|
175 | 175 | args = tuple(args) |
|
176 | 176 | assert not arg_bufs, "Shouldn't be any arg bufs left over" |
|
177 | 177 | |
|
178 | 178 | kwargs = {} |
|
179 | 179 | for key in info['kw_keys']: |
|
180 |
kwarg, kwarg_bufs = |
|
|
180 | kwarg, kwarg_bufs = deserialize_object(kwarg_bufs, g) | |
|
181 | 181 | kwargs[key] = kwarg |
|
182 | 182 | assert not kwarg_bufs, "Shouldn't be any kwarg bufs left over" |
|
183 | 183 |
@@ -18,6 +18,7 b' import os' | |||
|
18 | 18 | import pprint |
|
19 | 19 | import random |
|
20 | 20 | import uuid |
|
21 | import warnings | |
|
21 | 22 | from datetime import datetime |
|
22 | 23 | |
|
23 | 24 | try: |
@@ -492,7 +493,7 b' class Session(Configurable):' | |||
|
492 | 493 | """Return the nested message dict. |
|
493 | 494 | |
|
494 | 495 | This format is different from what is sent over the wire. The |
|
495 |
serialize/ |
|
|
496 | serialize/deserialize methods converts this nested message dict to the wire | |
|
496 | 497 | format, which is a list of message parts. |
|
497 | 498 | """ |
|
498 | 499 | msg = {} |
@@ -525,7 +526,7 b' class Session(Configurable):' | |||
|
525 | 526 | def serialize(self, msg, ident=None): |
|
526 | 527 | """Serialize the message components to bytes. |
|
527 | 528 | |
|
528 |
This is roughly the inverse of |
|
|
529 | This is roughly the inverse of deserialize. The serialize/deserialize | |
|
529 | 530 | methods work with full message lists, whereas pack/unpack work with |
|
530 | 531 | the individual message parts in the message list. |
|
531 | 532 | |
@@ -590,7 +591,7 b' class Session(Configurable):' | |||
|
590 | 591 | [ident1,ident2,...,DELIM,HMAC,p_header,p_parent,p_content, |
|
591 | 592 | buffer1,buffer2,...] |
|
592 | 593 | |
|
593 |
The serialize/ |
|
|
594 | The serialize/deserialize methods convert the nested message dict into this | |
|
594 | 595 | format. |
|
595 | 596 | |
|
596 | 597 | Parameters |
@@ -722,7 +723,7 b' class Session(Configurable):' | |||
|
722 | 723 | # invalid large messages can cause very expensive string comparisons |
|
723 | 724 | idents, msg_list = self.feed_identities(msg_list, copy) |
|
724 | 725 | try: |
|
725 |
return idents, self. |
|
|
726 | return idents, self.deserialize(msg_list, content=content, copy=copy) | |
|
726 | 727 | except Exception as e: |
|
727 | 728 | # TODO: handle it |
|
728 | 729 | raise e |
@@ -747,7 +748,7 b' class Session(Configurable):' | |||
|
747 | 748 | idents will always be a list of bytes, each of which is a ZMQ |
|
748 | 749 | identity. msg_list will be a list of bytes or zmq.Messages of the |
|
749 | 750 | form [HMAC,p_header,p_parent,p_content,buffer1,buffer2,...] and |
|
750 |
should be unpackable/unserializable via self. |
|
|
751 | should be unpackable/unserializable via self.deserialize at this | |
|
751 | 752 | point. |
|
752 | 753 | """ |
|
753 | 754 | if copy: |
@@ -788,10 +789,10 b' class Session(Configurable):' | |||
|
788 | 789 | to_cull = random.sample(self.digest_history, n_to_cull) |
|
789 | 790 | self.digest_history.difference_update(to_cull) |
|
790 | 791 | |
|
791 |
def |
|
|
792 | def deserialize(self, msg_list, content=True, copy=True): | |
|
792 | 793 | """Unserialize a msg_list to a nested message dict. |
|
793 | 794 | |
|
794 |
This is roughly the inverse of serialize. The serialize/ |
|
|
795 | This is roughly the inverse of serialize. The serialize/deserialize | |
|
795 | 796 | methods work with full message lists, whereas pack/unpack work with |
|
796 | 797 | the individual message parts in the message list. |
|
797 | 798 | |
@@ -842,10 +843,16 b' class Session(Configurable):' | |||
|
842 | 843 | message['content'] = msg_list[4] |
|
843 | 844 | |
|
844 | 845 | message['buffers'] = msg_list[5:] |
|
845 | # print("received: %s: %s\n %s" % (message['msg_type'], message['header'], message['content'])) | |
|
846 | 846 | # adapt to the current version |
|
847 | 847 | return adapt(message) |
|
848 | # print("adapted: %s: %s\n %s" % (adapted['msg_type'], adapted['header'], adapted['content'])) | |
|
848 | ||
|
849 | def unserialize(self, *args, **kwargs): | |
|
850 | warnings.warn( | |
|
851 | "Session.unserialize is deprecated. Use Session.deserialize.", | |
|
852 | DeprecationWarning, | |
|
853 | ) | |
|
854 | return self.deserialize(*args, **kwargs) | |
|
855 | ||
|
849 | 856 | |
|
850 | 857 | def test_msg2obj(): |
|
851 | 858 | am = dict(x=1) |
@@ -9,7 +9,7 b' from collections import namedtuple' | |||
|
9 | 9 | import nose.tools as nt |
|
10 | 10 | |
|
11 | 11 | # from unittest import TestCaes |
|
12 |
from IPython.kernel.zmq.serialize import serialize_object, |
|
|
12 | from IPython.kernel.zmq.serialize import serialize_object, deserialize_object | |
|
13 | 13 | from IPython.testing import decorators as dec |
|
14 | 14 | from IPython.utils.pickleutil import CannedArray, CannedClass |
|
15 | 15 | from IPython.utils.py3compat import iteritems |
@@ -22,7 +22,7 b' from IPython.parallel import interactive' | |||
|
22 | 22 | def roundtrip(obj): |
|
23 | 23 | """roundtrip an object through serialization""" |
|
24 | 24 | bufs = serialize_object(obj) |
|
25 |
obj2, remainder = |
|
|
25 | obj2, remainder = deserialize_object(bufs) | |
|
26 | 26 | nt.assert_equals(remainder, []) |
|
27 | 27 | return obj2 |
|
28 | 28 | |
@@ -70,7 +70,7 b' def test_roundtrip_buffered():' | |||
|
70 | 70 | ]: |
|
71 | 71 | bufs = serialize_object(obj) |
|
72 | 72 | nt.assert_equal(len(bufs), 2) |
|
73 |
obj2, remainder = |
|
|
73 | obj2, remainder = deserialize_object(bufs) | |
|
74 | 74 | nt.assert_equal(remainder, []) |
|
75 | 75 | nt.assert_equal(obj, obj2) |
|
76 | 76 | |
@@ -82,7 +82,7 b' def test_numpy():' | |||
|
82 | 82 | for dtype in DTYPES: |
|
83 | 83 | A = new_array(shape, dtype=dtype) |
|
84 | 84 | bufs = serialize_object(A) |
|
85 |
B, r = |
|
|
85 | B, r = deserialize_object(bufs) | |
|
86 | 86 | nt.assert_equal(r, []) |
|
87 | 87 | nt.assert_equal(A.shape, B.shape) |
|
88 | 88 | nt.assert_equal(A.dtype, B.dtype) |
@@ -100,7 +100,7 b' def test_recarray():' | |||
|
100 | 100 | A = new_array(shape, dtype=dtype) |
|
101 | 101 | |
|
102 | 102 | bufs = serialize_object(A) |
|
103 |
B, r = |
|
|
103 | B, r = deserialize_object(bufs) | |
|
104 | 104 | nt.assert_equal(r, []) |
|
105 | 105 | nt.assert_equal(A.shape, B.shape) |
|
106 | 106 | nt.assert_equal(A.dtype, B.dtype) |
@@ -116,7 +116,7 b' def test_numpy_in_seq():' | |||
|
116 | 116 | bufs = serialize_object((A,1,2,b'hello')) |
|
117 | 117 | canned = pickle.loads(bufs[0]) |
|
118 | 118 | nt.assert_is_instance(canned[0], CannedArray) |
|
119 |
tup, r = |
|
|
119 | tup, r = deserialize_object(bufs) | |
|
120 | 120 | B = tup[0] |
|
121 | 121 | nt.assert_equal(r, []) |
|
122 | 122 | nt.assert_equal(A.shape, B.shape) |
@@ -133,7 +133,7 b' def test_numpy_in_dict():' | |||
|
133 | 133 | bufs = serialize_object(dict(a=A,b=1,c=range(20))) |
|
134 | 134 | canned = pickle.loads(bufs[0]) |
|
135 | 135 | nt.assert_is_instance(canned['a'], CannedArray) |
|
136 |
d, r = |
|
|
136 | d, r = deserialize_object(bufs) | |
|
137 | 137 | B = d['a'] |
|
138 | 138 | nt.assert_equal(r, []) |
|
139 | 139 | nt.assert_equal(A.shape, B.shape) |
@@ -147,7 +147,7 b' def test_class():' | |||
|
147 | 147 | bufs = serialize_object(dict(C=C)) |
|
148 | 148 | canned = pickle.loads(bufs[0]) |
|
149 | 149 | nt.assert_is_instance(canned['C'], CannedClass) |
|
150 |
d, r = |
|
|
150 | d, r = deserialize_object(bufs) | |
|
151 | 151 | C2 = d['C'] |
|
152 | 152 | nt.assert_equal(C2.a, C.a) |
|
153 | 153 | |
@@ -159,7 +159,7 b' def test_class_oldstyle():' | |||
|
159 | 159 | bufs = serialize_object(dict(C=C)) |
|
160 | 160 | canned = pickle.loads(bufs[0]) |
|
161 | 161 | nt.assert_is_instance(canned['C'], CannedClass) |
|
162 |
d, r = |
|
|
162 | d, r = deserialize_object(bufs) | |
|
163 | 163 | C2 = d['C'] |
|
164 | 164 | nt.assert_equal(C2.a, C.a) |
|
165 | 165 | |
@@ -168,7 +168,7 b' def test_tuple():' | |||
|
168 | 168 | bufs = serialize_object(tup) |
|
169 | 169 | canned = pickle.loads(bufs[0]) |
|
170 | 170 | nt.assert_is_instance(canned, tuple) |
|
171 |
t2, r = |
|
|
171 | t2, r = deserialize_object(bufs) | |
|
172 | 172 | nt.assert_equal(t2[0](t2[1]), tup[0](tup[1])) |
|
173 | 173 | |
|
174 | 174 | point = namedtuple('point', 'x y') |
@@ -178,7 +178,7 b' def test_namedtuple():' | |||
|
178 | 178 | bufs = serialize_object(p) |
|
179 | 179 | canned = pickle.loads(bufs[0]) |
|
180 | 180 | nt.assert_is_instance(canned, point) |
|
181 |
p2, r = |
|
|
181 | p2, r = deserialize_object(bufs, globals()) | |
|
182 | 182 | nt.assert_equal(p2.x, p.x) |
|
183 | 183 | nt.assert_equal(p2.y, p.y) |
|
184 | 184 | |
@@ -187,7 +187,7 b' def test_list():' | |||
|
187 | 187 | bufs = serialize_object(lis) |
|
188 | 188 | canned = pickle.loads(bufs[0]) |
|
189 | 189 | nt.assert_is_instance(canned, list) |
|
190 |
l2, r = |
|
|
190 | l2, r = deserialize_object(bufs) | |
|
191 | 191 | nt.assert_equal(l2[0](l2[1]), lis[0](lis[1])) |
|
192 | 192 | |
|
193 | 193 | def test_class_inheritance(): |
@@ -202,7 +202,7 b' def test_class_inheritance():' | |||
|
202 | 202 | bufs = serialize_object(dict(D=D)) |
|
203 | 203 | canned = pickle.loads(bufs[0]) |
|
204 | 204 | nt.assert_is_instance(canned['D'], CannedClass) |
|
205 |
d, r = |
|
|
205 | d, r = deserialize_object(bufs) | |
|
206 | 206 | D2 = d['D'] |
|
207 | 207 | nt.assert_equal(D2.a, D.a) |
|
208 | 208 | nt.assert_equal(D2.b, D.b) |
@@ -60,7 +60,7 b' class TestSession(SessionTestCase):' | |||
|
60 | 60 | msg = self.session.msg('execute', content=dict(a=10, b=1.1)) |
|
61 | 61 | msg_list = self.session.serialize(msg, ident=b'foo') |
|
62 | 62 | ident, msg_list = self.session.feed_identities(msg_list) |
|
63 |
new_msg = self.session. |
|
|
63 | new_msg = self.session.deserialize(msg_list) | |
|
64 | 64 | self.assertEqual(ident[0], b'foo') |
|
65 | 65 | self.assertEqual(new_msg['msg_id'],msg['msg_id']) |
|
66 | 66 | self.assertEqual(new_msg['msg_type'],msg['msg_type']) |
@@ -82,7 +82,7 b' class TestSession(SessionTestCase):' | |||
|
82 | 82 | self.session.send(A, msg, ident=b'foo', buffers=[b'bar']) |
|
83 | 83 | |
|
84 | 84 | ident, msg_list = self.session.feed_identities(B.recv_multipart()) |
|
85 |
new_msg = self.session. |
|
|
85 | new_msg = self.session.deserialize(msg_list) | |
|
86 | 86 | self.assertEqual(ident[0], b'foo') |
|
87 | 87 | self.assertEqual(new_msg['msg_id'],msg['msg_id']) |
|
88 | 88 | self.assertEqual(new_msg['msg_type'],msg['msg_type']) |
@@ -100,7 +100,7 b' class TestSession(SessionTestCase):' | |||
|
100 | 100 | self.session.send(A, None, content=content, parent=parent, |
|
101 | 101 | header=header, metadata=metadata, ident=b'foo', buffers=[b'bar']) |
|
102 | 102 | ident, msg_list = self.session.feed_identities(B.recv_multipart()) |
|
103 |
new_msg = self.session. |
|
|
103 | new_msg = self.session.deserialize(msg_list) | |
|
104 | 104 | self.assertEqual(ident[0], b'foo') |
|
105 | 105 | self.assertEqual(new_msg['msg_id'],msg['msg_id']) |
|
106 | 106 | self.assertEqual(new_msg['msg_type'],msg['msg_type']) |
@@ -263,7 +263,7 b' class TestSession(SessionTestCase):' | |||
|
263 | 263 | p = session.msg('msg') |
|
264 | 264 | msg = session.msg('msg', content=content, metadata=metadata, parent=p['header']) |
|
265 | 265 | smsg = session.serialize(msg) |
|
266 |
msg2 = session. |
|
|
266 | msg2 = session.deserialize(session.feed_identities(smsg)[1]) | |
|
267 | 267 | assert isinstance(msg2['header']['date'], datetime) |
|
268 | 268 | self.assertEqual(msg['header'], msg2['header']) |
|
269 | 269 | self.assertEqual(msg['parent_header'], msg2['parent_header']) |
@@ -305,7 +305,7 b' class TestSession(SessionTestCase):' | |||
|
305 | 305 | self.session.send_raw(A, msg_list, ident=b'foo') |
|
306 | 306 | |
|
307 | 307 | ident, new_msg_list = self.session.feed_identities(B.recv_multipart()) |
|
308 |
new_msg = self.session. |
|
|
308 | new_msg = self.session.deserialize(new_msg_list) | |
|
309 | 309 | self.assertEqual(ident[0], b'foo') |
|
310 | 310 | self.assertEqual(new_msg['msg_type'],msg['msg_type']) |
|
311 | 311 | self.assertEqual(new_msg['header'],msg['header']) |
@@ -782,7 +782,7 b' class Client(HasTraits):' | |||
|
782 | 782 | |
|
783 | 783 | # construct result: |
|
784 | 784 | if content['status'] == 'ok': |
|
785 |
self.results[msg_id] = serialize. |
|
|
785 | self.results[msg_id] = serialize.deserialize_object(msg['buffers'])[0] | |
|
786 | 786 | elif content['status'] == 'aborted': |
|
787 | 787 | self.results[msg_id] = error.TaskAborted(msg_id) |
|
788 | 788 | elif content['status'] == 'resubmitted': |
@@ -884,7 +884,7 b' class Client(HasTraits):' | |||
|
884 | 884 | elif msg_type == 'execute_result': |
|
885 | 885 | md['execute_result'] = content |
|
886 | 886 | elif msg_type == 'data_message': |
|
887 |
data, remainder = serialize. |
|
|
887 | data, remainder = serialize.deserialize_object(msg['buffers']) | |
|
888 | 888 | md['data'].update(data) |
|
889 | 889 | elif msg_type == 'status': |
|
890 | 890 | # idle message comes after all outputs |
@@ -1593,7 +1593,7 b' class Client(HasTraits):' | |||
|
1593 | 1593 | |
|
1594 | 1594 | if rcontent['status'] == 'ok': |
|
1595 | 1595 | if header['msg_type'] == 'apply_reply': |
|
1596 |
res,buffers = serialize. |
|
|
1596 | res,buffers = serialize.deserialize_object(buffers) | |
|
1597 | 1597 | elif header['msg_type'] == 'execute_reply': |
|
1598 | 1598 | res = ExecuteReply(msg_id, rcontent, md) |
|
1599 | 1599 | else: |
@@ -523,7 +523,7 b' class Hub(SessionFactory):' | |||
|
523 | 523 | return |
|
524 | 524 | client_id = idents[0] |
|
525 | 525 | try: |
|
526 |
msg = self.session. |
|
|
526 | msg = self.session.deserialize(msg, content=True) | |
|
527 | 527 | except Exception: |
|
528 | 528 | content = error.wrap_exception() |
|
529 | 529 | self.log.error("Bad Query Message: %r", msg, exc_info=True) |
@@ -588,7 +588,7 b' class Hub(SessionFactory):' | |||
|
588 | 588 | return |
|
589 | 589 | queue_id, client_id = idents[:2] |
|
590 | 590 | try: |
|
591 |
msg = self.session. |
|
|
591 | msg = self.session.deserialize(msg) | |
|
592 | 592 | except Exception: |
|
593 | 593 | self.log.error("queue::client %r sent invalid message to %r: %r", client_id, queue_id, msg, exc_info=True) |
|
594 | 594 | return |
@@ -636,7 +636,7 b' class Hub(SessionFactory):' | |||
|
636 | 636 | |
|
637 | 637 | client_id, queue_id = idents[:2] |
|
638 | 638 | try: |
|
639 |
msg = self.session. |
|
|
639 | msg = self.session.deserialize(msg) | |
|
640 | 640 | except Exception: |
|
641 | 641 | self.log.error("queue::engine %r sent invalid message to %r: %r", |
|
642 | 642 | queue_id, client_id, msg, exc_info=True) |
@@ -690,7 +690,7 b' class Hub(SessionFactory):' | |||
|
690 | 690 | client_id = idents[0] |
|
691 | 691 | |
|
692 | 692 | try: |
|
693 |
msg = self.session. |
|
|
693 | msg = self.session.deserialize(msg) | |
|
694 | 694 | except Exception: |
|
695 | 695 | self.log.error("task::client %r sent invalid task message: %r", |
|
696 | 696 | client_id, msg, exc_info=True) |
@@ -740,7 +740,7 b' class Hub(SessionFactory):' | |||
|
740 | 740 | """save the result of a completed task.""" |
|
741 | 741 | client_id = idents[0] |
|
742 | 742 | try: |
|
743 |
msg = self.session. |
|
|
743 | msg = self.session.deserialize(msg) | |
|
744 | 744 | except Exception: |
|
745 | 745 | self.log.error("task::invalid task result message send to %r: %r", |
|
746 | 746 | client_id, msg, exc_info=True) |
@@ -794,7 +794,7 b' class Hub(SessionFactory):' | |||
|
794 | 794 | |
|
795 | 795 | def save_task_destination(self, idents, msg): |
|
796 | 796 | try: |
|
797 |
msg = self.session. |
|
|
797 | msg = self.session.deserialize(msg, content=True) | |
|
798 | 798 | except Exception: |
|
799 | 799 | self.log.error("task::invalid task tracking message", exc_info=True) |
|
800 | 800 | return |
@@ -831,7 +831,7 b' class Hub(SessionFactory):' | |||
|
831 | 831 | """save an iopub message into the db""" |
|
832 | 832 | # print (topics) |
|
833 | 833 | try: |
|
834 |
msg = self.session. |
|
|
834 | msg = self.session.deserialize(msg, content=True) | |
|
835 | 835 | except Exception: |
|
836 | 836 | self.log.error("iopub::invalid IOPub message", exc_info=True) |
|
837 | 837 | return |
@@ -251,7 +251,7 b' class TaskScheduler(SessionFactory):' | |||
|
251 | 251 | self.log.warn("task::Invalid Message: %r",msg) |
|
252 | 252 | return |
|
253 | 253 | try: |
|
254 |
msg = self.session. |
|
|
254 | msg = self.session.deserialize(msg) | |
|
255 | 255 | except ValueError: |
|
256 | 256 | self.log.warn("task::Unauthorized message from: %r"%idents) |
|
257 | 257 | return |
@@ -270,7 +270,7 b' class TaskScheduler(SessionFactory):' | |||
|
270 | 270 | self.log.warn("task::Invalid Message: %r",msg) |
|
271 | 271 | return |
|
272 | 272 | try: |
|
273 |
msg = self.session. |
|
|
273 | msg = self.session.deserialize(msg) | |
|
274 | 274 | except ValueError: |
|
275 | 275 | self.log.warn("task::Unauthorized message from: %r"%idents) |
|
276 | 276 | return |
@@ -375,7 +375,7 b' class TaskScheduler(SessionFactory):' | |||
|
375 | 375 | self.notifier_stream.flush() |
|
376 | 376 | try: |
|
377 | 377 | idents, msg = self.session.feed_identities(raw_msg, copy=False) |
|
378 |
msg = self.session. |
|
|
378 | msg = self.session.deserialize(msg, content=False, copy=False) | |
|
379 | 379 | except Exception: |
|
380 | 380 | self.log.error("task::Invaid task msg: %r"%raw_msg, exc_info=True) |
|
381 | 381 | return |
@@ -621,7 +621,7 b' class TaskScheduler(SessionFactory):' | |||
|
621 | 621 | """dispatch method for result replies""" |
|
622 | 622 | try: |
|
623 | 623 | idents,msg = self.session.feed_identities(raw_msg, copy=False) |
|
624 |
msg = self.session. |
|
|
624 | msg = self.session.deserialize(msg, content=False, copy=False) | |
|
625 | 625 | engine = idents[0] |
|
626 | 626 | try: |
|
627 | 627 | idx = self.targets.index(engine) |
@@ -159,7 +159,7 b' class EngineFactory(RegistrationFactory):' | |||
|
159 | 159 | loop = self.loop |
|
160 | 160 | identity = self.bident |
|
161 | 161 | idents,msg = self.session.feed_identities(msg) |
|
162 |
msg = self.session. |
|
|
162 | msg = self.session.deserialize(msg) | |
|
163 | 163 | content = msg['content'] |
|
164 | 164 | info = self.connection_info |
|
165 | 165 |
General Comments 0
You need to be logged in to leave comments.
Login now