##// END OF EJS Templates
Fixing numerous bugs in ipcluster on Win32....
Administrator -
Show More
@@ -31,6 +31,8 b' from IPython.external import Itpl'
31 31 from IPython.kernel.twistedutil import gatherBoth
32 32 from IPython.kernel.util import printer
33 33 from IPython.genutils import get_ipython_dir, num_cpus
34 from IPython.kernel.fcutil import have_crypto
35 from IPython.kernel.error import SecurityError
34 36
35 37 #-----------------------------------------------------------------------------
36 38 # General process handling code
@@ -174,7 +176,13 b' class ControllerLauncher(ProcessLauncher):'
174 176
175 177 def __init__(self, extra_args=None):
176 178 if sys.platform == 'win32':
177 args = [find_exe('ipcontroller')]
179 # This logic is needed because the ipcontroller script doesn't
180 # always get installed in the same way or in the same location.
181 from IPython.kernel.scripts import ipcontroller
182 script_location = ipcontroller.__file__.replace('.pyc', '.py')
183 # The -u option here turns on unbuffered output, which is required
184 # on Win32 to prevent wierd conflict and problems with Twisted
185 args = [find_exe('python'), '-u', script_location]
178 186 else:
179 187 args = ['ipcontroller']
180 188 self.extra_args = extra_args
@@ -188,7 +196,13 b' class EngineLauncher(ProcessLauncher):'
188 196
189 197 def __init__(self, extra_args=None):
190 198 if sys.platform == 'win32':
191 args = [find_exe('ipengine')]
199 # This logic is needed because the ipcontroller script doesn't
200 # always get installed in the same way or in the same location.
201 from IPython.kernel.scripts import ipengine
202 script_location = ipengine.__file__.replace('.pyc', '.py')
203 # The -u option here turns on unbuffered output, which is required
204 # on Win32 to prevent wierd conflict and problems with Twisted
205 args = [find_exe('python'), '-u', script_location]
192 206 else:
193 207 args = ['ipengine']
194 208 self.extra_args = extra_args
@@ -314,13 +328,27 b' class PBSEngineSet(BatchEngineSet):'
314 328 # The main functions should then just parse the command line arguments, create
315 329 # the appropriate class and call a 'start' method.
316 330
317 def main_local(args):
318 cont_args = []
319 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
331 def check_security(args, cont_args):
332 if (not args.x or not args.y) and not have_crypto:
333 log.err("""
334 OpenSSL/pyOpenSSL is not available, so we can't run in secure mode.
335 Try running ipcluster with the -xy flags: ipcluster local -xy -n 4""")
336 reactor.stop()
337 return False
320 338 if args.x:
321 339 cont_args.append('-x')
322 340 if args.y:
323 341 cont_args.append('-y')
342 return True
343
344 def main_local(args):
345 cont_args = []
346 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
347
348 # Check security settings before proceeding
349 keep_going = check_security(args, cont_args)
350 if not keep_going: return
351
324 352 cl = ControllerLauncher(extra_args=cont_args)
325 353 dstart = cl.start()
326 354 def start_engines(cont_pid):
@@ -349,10 +377,11 b' def main_local(args):'
349 377 def main_mpirun(args):
350 378 cont_args = []
351 379 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
352 if args.x:
353 cont_args.append('-x')
354 if args.y:
355 cont_args.append('-y')
380
381 # Check security settings before proceeding
382 keep_going = check_security(args, cont_args)
383 if not keep_going: return
384
356 385 cl = ControllerLauncher(extra_args=cont_args)
357 386 dstart = cl.start()
358 387 def start_engines(cont_pid):
@@ -385,10 +414,11 b' def main_mpirun(args):'
385 414 def main_pbs(args):
386 415 cont_args = []
387 416 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
388 if args.x:
389 cont_args.append('-x')
390 if args.y:
391 cont_args.append('-y')
417
418 # Check security settings before proceeding
419 keep_going = check_security(args, cont_args)
420 if not keep_going: return
421
392 422 cl = ControllerLauncher(extra_args=cont_args)
393 423 dstart = cl.start()
394 424 def start_engines(r):
General Comments 0
You need to be logged in to leave comments. Login now