Show More
@@ -166,11 +166,11 b' class IPythonConsoleApp(Configurable):' | |||
|
166 | 166 | hb_port = Int(0, config=True, |
|
167 | 167 | help="set the heartbeat port [default: random]") |
|
168 | 168 | shell_port = Int(0, config=True, |
|
169 |
help="set the shell ( |
|
|
169 | help="set the shell (ROUTER) port [default: random]") | |
|
170 | 170 | iopub_port = Int(0, config=True, |
|
171 | 171 | help="set the iopub (PUB) port [default: random]") |
|
172 | 172 | stdin_port = Int(0, config=True, |
|
173 |
help="set the stdin ( |
|
|
173 | help="set the stdin (DEALER) port [default: random]") | |
|
174 | 174 | connection_file = Unicode('', config=True, |
|
175 | 175 | help="""JSON file in which to store connection info [default: kernel-<pid>.json] |
|
176 | 176 |
@@ -193,7 +193,7 b' class MultiKernelManager(LoggingConfigurable):' | |||
|
193 | 193 | def create_shell_stream(self, kernel_id): |
|
194 | 194 | ip = self.get_kernel_ip(kernel_id) |
|
195 | 195 | ports = self.get_kernel_ports(kernel_id) |
|
196 |
shell_stream = self.create_connected_stream(ip, ports['shell_port'], zmq. |
|
|
196 | shell_stream = self.create_connected_stream(ip, ports['shell_port'], zmq.DEALER) | |
|
197 | 197 | return shell_stream |
|
198 | 198 | |
|
199 | 199 | def create_hb_stream(self, kernel_id): |
@@ -76,7 +76,7 b' class ZMQSubHandler(ZMQHandler):' | |||
|
76 | 76 | self.get_stream().on_recv(self._handle_msgs) |
|
77 | 77 | |
|
78 | 78 | |
|
79 |
class ZMQ |
|
|
79 | class ZMQDealerHandler(ZMQHandler): | |
|
80 | 80 | |
|
81 | 81 | SUPPORTED_METHODS = ("POST",) |
|
82 | 82 |
@@ -365,7 +365,7 b' class IPControllerApp(BaseParallelApplication):' | |||
|
365 | 365 | scheme = TaskScheduler.scheme_name.get_default_value() |
|
366 | 366 | # Task Queue (in a Process) |
|
367 | 367 | if scheme == 'pure': |
|
368 |
self.log.warn("task::using pure |
|
|
368 | self.log.warn("task::using pure DEALER Task scheduler") | |
|
369 | 369 | q = mq(zmq.ROUTER, zmq.DEALER, zmq.PUB, b'intask', b'outtask') |
|
370 | 370 | # q.setsockopt_out(zmq.HWM, hub.hwm) |
|
371 | 371 | q.bind_in(hub.client_info['task'][1]) |
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | """ |
|
3 |
A multi-heart Heartbeat system using PUB and |
|
|
4 |
and hearts are tracked based on their |
|
|
3 | A multi-heart Heartbeat system using PUB and ROUTER sockets. pings are sent out on the PUB, | |
|
4 | and hearts are tracked based on their DEALER identities. | |
|
5 | 5 | |
|
6 | 6 | Authors: |
|
7 | 7 | |
@@ -34,9 +34,9 b' class Heart(object):' | |||
|
34 | 34 | Device model for responding to heartbeats. |
|
35 | 35 | |
|
36 | 36 | It simply builds a threadsafe zmq.FORWARDER Device, defaulting to using |
|
37 |
SUB/ |
|
|
37 | SUB/DEALER for in/out. | |
|
38 | 38 | |
|
39 |
You can specify the |
|
|
39 | You can specify the DEALER's IDENTITY via the optional heart_id argument.""" | |
|
40 | 40 | device=None |
|
41 | 41 | id=None |
|
42 | 42 | def __init__(self, in_addr, out_addr, in_type=zmq.SUB, out_type=zmq.DEALER, heart_id=None): |
@@ -62,7 +62,7 b' class Heart(object):' | |||
|
62 | 62 | class HeartMonitor(LoggingConfigurable): |
|
63 | 63 | """A basic HeartMonitor class |
|
64 | 64 | pingstream: a PUB stream |
|
65 |
pongstream: an |
|
|
65 | pongstream: an ROUTER stream | |
|
66 | 66 | period: the period of the heartbeat in milliseconds""" |
|
67 | 67 | |
|
68 | 68 | period = Integer(3000, config=True, |
@@ -171,11 +171,11 b" if __name__ == '__main__':" | |||
|
171 | 171 | context = zmq.Context() |
|
172 | 172 | pub = context.socket(zmq.PUB) |
|
173 | 173 | pub.bind('tcp://127.0.0.1:5555') |
|
174 |
|
|
|
175 |
|
|
|
174 | router = context.socket(zmq.ROUTER) | |
|
175 | router.bind('tcp://127.0.0.1:5556') | |
|
176 | 176 | |
|
177 | 177 | outstream = zmqstream.ZMQStream(pub, loop) |
|
178 |
instream = zmqstream.ZMQStream( |
|
|
178 | instream = zmqstream.ZMQStream(router, loop) | |
|
179 | 179 | |
|
180 | 180 | hb = HeartMonitor(loop, outstream, instream) |
|
181 | 181 |
@@ -108,9 +108,9 b' class EngineConnector(HasTraits):' | |||
|
108 | 108 | Attributes are: |
|
109 | 109 | id (int): engine ID |
|
110 | 110 | uuid (str): uuid (unused?) |
|
111 |
queue (str): identity of queue's |
|
|
112 |
registration (str): identity of registration |
|
|
113 |
heartbeat (str): identity of heartbeat |
|
|
111 | queue (str): identity of queue's DEALER socket | |
|
112 | registration (str): identity of registration DEALER socket | |
|
113 | heartbeat (str): identity of heartbeat DEALER socket | |
|
114 | 114 | """ |
|
115 | 115 | id=Integer(0) |
|
116 | 116 | queue=CBytes() |
@@ -124,7 +124,7 b' class HubFactory(RegistrationFactory):' | |||
|
124 | 124 | |
|
125 | 125 | # port-pairs for monitoredqueues: |
|
126 | 126 | hb = Tuple(Integer,Integer,config=True, |
|
127 |
help=""" |
|
|
127 | help="""DEALER/SUB Port pair for Engine heartbeats""") | |
|
128 | 128 | def _hb_default(self): |
|
129 | 129 | return tuple(util.select_random_ports(2)) |
|
130 | 130 | |
@@ -309,7 +309,7 b' class Hub(SessionFactory):' | |||
|
309 | 309 | session: Session object |
|
310 | 310 | <removed> context: zmq context for creating new connections (?) |
|
311 | 311 | queue: ZMQStream for monitoring the command queue (SUB) |
|
312 |
query: ZMQStream for engine registration and client queries requests ( |
|
|
312 | query: ZMQStream for engine registration and client queries requests (ROUTER) | |
|
313 | 313 | heartbeat: HeartMonitor object checking the pulse of the engines |
|
314 | 314 | notifier: ZMQStream for broadcasting engine registration changes (PUB) |
|
315 | 315 | db: connection to db for out of memory logging of commands |
@@ -609,7 +609,7 b' class TaskScheduler(SessionFactory):' | |||
|
609 | 609 | # first, relay result to client |
|
610 | 610 | engine = idents[0] |
|
611 | 611 | client = idents[1] |
|
612 |
# swap_ids for |
|
|
612 | # swap_ids for ROUTER-ROUTER mirror | |
|
613 | 613 | raw_msg[:2] = [client,engine] |
|
614 | 614 | # print (map(str, raw_msg[:4])) |
|
615 | 615 | self.client_stream.send_multipart(raw_msg, copy=False) |
@@ -33,9 +33,9 b' def patch_pyzmq():' | |||
|
33 | 33 | |
|
34 | 34 | # fix missing DEALER/ROUTER aliases in pyzmq < 2.1.9 |
|
35 | 35 | if not hasattr(zmq, 'DEALER'): |
|
36 |
zmq.DEALER = zmq. |
|
|
36 | zmq.DEALER = zmq.DEALER | |
|
37 | 37 | if not hasattr(zmq, 'ROUTER'): |
|
38 |
zmq.ROUTER = zmq. |
|
|
38 | zmq.ROUTER = zmq.ROUTER | |
|
39 | 39 | |
|
40 | 40 | # fallback on stdlib json if jsonlib is selected, because jsonlib breaks things. |
|
41 | 41 | # jsonlib support is removed from pyzmq >= 2.2.0 |
@@ -31,7 +31,7 b' def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, ' | |||
|
31 | 31 | The path to the file to write |
|
32 | 32 | |
|
33 | 33 | shell_port : int, optional |
|
34 |
The port to use for |
|
|
34 | The port to use for ROUTER channel. | |
|
35 | 35 | |
|
36 | 36 | iopub_port : int, optional |
|
37 | 37 | The port to use for the SUB channel. |
@@ -112,9 +112,9 b' class KernelApp(BaseIPythonApplication):' | |||
|
112 | 112 | ip = Unicode(LOCALHOST, config=True, |
|
113 | 113 | help="Set the IP or interface on which the kernel will listen.") |
|
114 | 114 | hb_port = Integer(0, config=True, help="set the heartbeat port [default: random]") |
|
115 |
shell_port = Integer(0, config=True, help="set the shell ( |
|
|
115 | shell_port = Integer(0, config=True, help="set the shell (ROUTER) port [default: random]") | |
|
116 | 116 | iopub_port = Integer(0, config=True, help="set the iopub (PUB) port [default: random]") |
|
117 |
stdin_port = Integer(0, config=True, help="set the stdin ( |
|
|
117 | stdin_port = Integer(0, config=True, help="set the stdin (DEALER) port [default: random]") | |
|
118 | 118 | connection_file = Unicode('', config=True, |
|
119 | 119 | help="""JSON file in which to store connection info [default: kernel-<pid>.json] |
|
120 | 120 |
@@ -181,7 +181,7 b' class ZMQSocketChannel(Thread):' | |||
|
181 | 181 | |
|
182 | 182 | |
|
183 | 183 | class ShellSocketChannel(ZMQSocketChannel): |
|
184 |
"""The |
|
|
184 | """The DEALER channel for issues request/replies to the kernel. | |
|
185 | 185 | """ |
|
186 | 186 | |
|
187 | 187 | command_queue = None |
General Comments 0
You need to be logged in to leave comments.
Login now