Show More
@@ -28,7 +28,7 b' from IPython.zmq.entry_point import bind_port' | |||||
28 |
|
28 | |||
29 | from streamsession import Message, wrap_exception |
|
29 | from streamsession import Message, wrap_exception | |
30 | from entry_point import (make_base_argument_parser, select_random_ports, split_ports, |
|
30 | from entry_point import (make_base_argument_parser, select_random_ports, split_ports, | |
31 | connect_logger, parse_url) |
|
31 | connect_logger, parse_url, signal_children) | |
32 |
|
32 | |||
33 | #----------------------------------------------------------------------------- |
|
33 | #----------------------------------------------------------------------------- | |
34 | # Code |
|
34 | # Code | |
@@ -882,6 +882,7 b' def main():' | |||||
882 | sub = ZMQStream(sub, loop) |
|
882 | sub = ZMQStream(sub, loop) | |
883 |
|
883 | |||
884 | ports = select_random_ports(random_ports) |
|
884 | ports = select_random_ports(random_ports) | |
|
885 | children = [] | |||
885 | # Multiplexer Queue (in a Process) |
|
886 | # Multiplexer Queue (in a Process) | |
886 | if not mux: |
|
887 | if not mux: | |
887 | mux = (ports.pop(),ports.pop()) |
|
888 | mux = (ports.pop(),ports.pop()) | |
@@ -891,6 +892,7 b' def main():' | |||||
891 | q.connect_mon(iface%monport) |
|
892 | q.connect_mon(iface%monport) | |
892 | q.daemon=True |
|
893 | q.daemon=True | |
893 | q.start() |
|
894 | q.start() | |
|
895 | children.append(q.launcher) | |||
894 |
|
896 | |||
895 | # Control Queue (in a Process) |
|
897 | # Control Queue (in a Process) | |
896 | if not control: |
|
898 | if not control: | |
@@ -901,7 +903,7 b' def main():' | |||||
901 | q.connect_mon(iface%monport) |
|
903 | q.connect_mon(iface%monport) | |
902 | q.daemon=True |
|
904 | q.daemon=True | |
903 | q.start() |
|
905 | q.start() | |
904 |
|
906 | children.append(q.launcher) | ||
905 | # Task Queue (in a Process) |
|
907 | # Task Queue (in a Process) | |
906 | if not task: |
|
908 | if not task: | |
907 | task = (ports.pop(),ports.pop()) |
|
909 | task = (ports.pop(),ports.pop()) | |
@@ -912,12 +914,14 b' def main():' | |||||
912 | q.connect_mon(iface%monport) |
|
914 | q.connect_mon(iface%monport) | |
913 | q.daemon=True |
|
915 | q.daemon=True | |
914 | q.start() |
|
916 | q.start() | |
|
917 | children.append(q.launcher) | |||
915 | else: |
|
918 | else: | |
916 | sargs = (iface%task[0],iface%task[1],iface%monport,iface%nport,args.scheduler) |
|
919 | sargs = (iface%task[0],iface%task[1],iface%monport,iface%nport,args.scheduler) | |
917 | print (sargs) |
|
920 | print (sargs) | |
918 |
|
|
921 | q = Process(target=launch_scheduler, args=sargs) | |
919 |
|
|
922 | q.daemon=True | |
920 |
|
|
923 | q.start() | |
|
924 | children.append(q) | |||
921 |
|
925 | |||
922 | time.sleep(.25) |
|
926 | time.sleep(.25) | |
923 |
|
927 | |||
@@ -937,9 +941,13 b' def main():' | |||||
937 | 'task' : iface%task[0], |
|
941 | 'task' : iface%task[0], | |
938 | 'notification': iface%nport |
|
942 | 'notification': iface%nport | |
939 | } |
|
943 | } | |
|
944 | signal_children(children) | |||
940 | con = Controller(loop, thesession, sub, reg, hmon, c, n, None, engine_addrs, client_addrs) |
|
945 | con = Controller(loop, thesession, sub, reg, hmon, c, n, None, engine_addrs, client_addrs) | |
941 | dc = ioloop.DelayedCallback(lambda : print("Controller started..."), 100, loop) |
|
946 | dc = ioloop.DelayedCallback(lambda : print("Controller started..."), 100, loop) | |
942 | loop.start() |
|
947 | loop.start() | |
|
948 | ||||
|
949 | ||||
|
950 | ||||
943 |
|
951 | |||
944 | if __name__ == '__main__': |
|
952 | if __name__ == '__main__': | |
945 | main() |
|
953 | main() |
@@ -5,10 +5,15 b' launchers.' | |||||
5 | # Standard library imports. |
|
5 | # Standard library imports. | |
6 | import logging |
|
6 | import logging | |
7 | import atexit |
|
7 | import atexit | |
|
8 | import sys | |||
8 | import os |
|
9 | import os | |
9 | import socket |
|
10 | import socket | |
10 | from subprocess import Popen, PIPE |
|
11 | from subprocess import Popen, PIPE | |
11 | import sys |
|
12 | from signal import signal, SIGINT, SIGABRT, SIGTERM | |
|
13 | try: | |||
|
14 | from signal import SIGKILL | |||
|
15 | except ImportError: | |||
|
16 | SIGKILL=None | |||
12 |
|
17 | |||
13 | # System library imports. |
|
18 | # System library imports. | |
14 | import zmq |
|
19 | import zmq | |
@@ -50,8 +55,14 b' def parse_url(args):' | |||||
50 | if iface[1]: |
|
55 | if iface[1]: | |
51 | args.regport = iface[1] |
|
56 | args.regport = iface[1] | |
52 | args.url = "%s://%s:%i"%(args.transport, args.ip,args.regport) |
|
57 | args.url = "%s://%s:%i"%(args.transport, args.ip,args.regport) | |
53 |
|
58 | |||
54 |
|
59 | def signal_children(children): | ||
|
60 | def terminate_children(sig, frame): | |||
|
61 | for child in children: | |||
|
62 | child.terminate() | |||
|
63 | # sys.exit(sig) | |||
|
64 | for sig in (SIGINT, SIGABRT, SIGTERM): | |||
|
65 | signal(sig, terminate_children) | |||
55 |
|
66 | |||
56 | def make_base_argument_parser(): |
|
67 | def make_base_argument_parser(): | |
57 | """ Creates an ArgumentParser for the generic arguments supported by all |
|
68 | """ Creates an ArgumentParser for the generic arguments supported by all |
@@ -28,6 +28,7 b' class Heart(object):' | |||||
28 | id=None |
|
28 | id=None | |
29 | def __init__(self, in_addr, out_addr, in_type=zmq.SUB, out_type=zmq.XREQ, heart_id=None): |
|
29 | def __init__(self, in_addr, out_addr, in_type=zmq.SUB, out_type=zmq.XREQ, heart_id=None): | |
30 | self.device = ProcessDevice(zmq.FORWARDER, in_type, out_type) |
|
30 | self.device = ProcessDevice(zmq.FORWARDER, in_type, out_type) | |
|
31 | self.device.daemon=True | |||
31 | self.device.connect_in(in_addr) |
|
32 | self.device.connect_in(in_addr) | |
32 | self.device.connect_out(out_addr) |
|
33 | self.device.connect_out(out_addr) | |
33 | if in_type == zmq.SUB: |
|
34 | if in_type == zmq.SUB: |
1 | NO CONTENT: file renamed from IPython/zmq/tests/test_controller.py to IPython/zmq/parallel/tests/test_controller.py |
|
NO CONTENT: file renamed from IPython/zmq/tests/test_controller.py to IPython/zmq/parallel/tests/test_controller.py |
@@ -1,4 +1,4 b'' | |||||
1 |
|
1 | |||
2 | from unittest import TestCase |
|
2 | from unittest import TestCase | |
3 | from zmq.tests import BaseZMQTest |
|
3 | # from zmq.tests import BaseZMQTest | |
4 |
|
4 |
1 | NO CONTENT: file renamed from IPython/zmq/tests/test_streamsession.py to IPython/zmq/parallel/tests/test_streamsession.py |
|
NO CONTENT: file renamed from IPython/zmq/tests/test_streamsession.py to IPython/zmq/parallel/tests/test_streamsession.py |
General Comments 0
You need to be logged in to leave comments.
Login now