##// END OF EJS Templates
ipclusterz notices if controller fails to start
MinRK -
Show More
@@ -1,6 +1,7 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 from __future__ import print_function
2 from __future__ import print_function
3 import sys,os
3 import sys,os
4 import time
4 from subprocess import Popen, PIPE
5 from subprocess import Popen, PIPE
5
6
6 from entry_point import parse_url
7 from entry_point import parse_url
@@ -52,7 +53,7 b' def launch_process(mod, args):'
52 blackholew = file(os.devnull, 'w')
53 blackholew = file(os.devnull, 'w')
53 blackholer = file(os.devnull, 'r')
54 blackholer = file(os.devnull, 'r')
54
55
55 proc = Popen(arguments, stdin=blackholer, stdout=blackholew, stderr=blackholew)
56 proc = Popen(arguments, stdin=blackholer, stdout=blackholew, stderr=PIPE)
56 return proc
57 return proc
57
58
58 def main():
59 def main():
@@ -67,6 +68,13 b' def main():'
67 '--transport','--loglevel','--packer'])+['--ident']
68 '--transport','--loglevel','--packer'])+['--ident']
68
69
69 controller = launch_process('controller', controller_args)
70 controller = launch_process('controller', controller_args)
71 for i in range(10):
72 time.sleep(.1)
73 if controller.poll() is not None:
74 print("Controller failed to launch:")
75 print (controller.stderr.read())
76 sys.exit(255)
77
70 print("Launched Controller at %s"%args.url)
78 print("Launched Controller at %s"%args.url)
71 engines = [ launch_process('engine', engine_args+['engine-%i'%i]) for i in range(args.n) ]
79 engines = [ launch_process('engine', engine_args+['engine-%i'%i]) for i in range(args.n) ]
72 print("%i Engines started"%args.n)
80 print("%i Engines started"%args.n)
@@ -76,9 +84,10 b' def main():'
76 p.wait()
84 p.wait()
77 except KeyboardInterrupt:
85 except KeyboardInterrupt:
78 pass
86 pass
87
79 wait_quietly(controller)
88 wait_quietly(controller)
80 map(wait_quietly, engines)
89 map(wait_quietly, engines)
81 print ("Done")
90 print ("Engines cleaned up.")
82
91
83 if __name__ == '__main__':
92 if __name__ == '__main__':
84 main() No newline at end of file
93 main()
General Comments 0
You need to be logged in to leave comments. Login now