Show More
@@ -31,6 +31,8 b' from IPython.external import Itpl' | |||||
31 | from IPython.kernel.twistedutil import gatherBoth |
|
31 | from IPython.kernel.twistedutil import gatherBoth | |
32 | from IPython.kernel.util import printer |
|
32 | from IPython.kernel.util import printer | |
33 | from IPython.genutils import get_ipython_dir, num_cpus |
|
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 | # General process handling code |
|
38 | # General process handling code | |
@@ -174,7 +176,13 b' class ControllerLauncher(ProcessLauncher):' | |||||
174 |
|
176 | |||
175 | def __init__(self, extra_args=None): |
|
177 | def __init__(self, extra_args=None): | |
176 | if sys.platform == 'win32': |
|
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 | else: |
|
186 | else: | |
179 | args = ['ipcontroller'] |
|
187 | args = ['ipcontroller'] | |
180 | self.extra_args = extra_args |
|
188 | self.extra_args = extra_args | |
@@ -188,7 +196,13 b' class EngineLauncher(ProcessLauncher):' | |||||
188 |
|
196 | |||
189 | def __init__(self, extra_args=None): |
|
197 | def __init__(self, extra_args=None): | |
190 | if sys.platform == 'win32': |
|
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 | else: |
|
206 | else: | |
193 | args = ['ipengine'] |
|
207 | args = ['ipengine'] | |
194 | self.extra_args = extra_args |
|
208 | self.extra_args = extra_args | |
@@ -314,13 +328,27 b' class PBSEngineSet(BatchEngineSet):' | |||||
314 | # The main functions should then just parse the command line arguments, create |
|
328 | # The main functions should then just parse the command line arguments, create | |
315 | # the appropriate class and call a 'start' method. |
|
329 | # the appropriate class and call a 'start' method. | |
316 |
|
330 | |||
317 | def main_local(args): |
|
331 | def check_security(args, cont_args): | |
318 | cont_args = [] |
|
332 | if (not args.x or not args.y) and not have_crypto: | |
319 | cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller')) |
|
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 | if args.x: |
|
338 | if args.x: | |
321 | cont_args.append('-x') |
|
339 | cont_args.append('-x') | |
322 | if args.y: |
|
340 | if args.y: | |
323 | cont_args.append('-y') |
|
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 | cl = ControllerLauncher(extra_args=cont_args) |
|
352 | cl = ControllerLauncher(extra_args=cont_args) | |
325 | dstart = cl.start() |
|
353 | dstart = cl.start() | |
326 | def start_engines(cont_pid): |
|
354 | def start_engines(cont_pid): | |
@@ -349,10 +377,11 b' def main_local(args):' | |||||
349 | def main_mpirun(args): |
|
377 | def main_mpirun(args): | |
350 | cont_args = [] |
|
378 | cont_args = [] | |
351 | cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller')) |
|
379 | cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller')) | |
352 | if args.x: |
|
380 | ||
353 | cont_args.append('-x') |
|
381 | # Check security settings before proceeding | |
354 | if args.y: |
|
382 | keep_going = check_security(args, cont_args) | |
355 | cont_args.append('-y') |
|
383 | if not keep_going: return | |
|
384 | ||||
356 | cl = ControllerLauncher(extra_args=cont_args) |
|
385 | cl = ControllerLauncher(extra_args=cont_args) | |
357 | dstart = cl.start() |
|
386 | dstart = cl.start() | |
358 | def start_engines(cont_pid): |
|
387 | def start_engines(cont_pid): | |
@@ -385,10 +414,11 b' def main_mpirun(args):' | |||||
385 | def main_pbs(args): |
|
414 | def main_pbs(args): | |
386 | cont_args = [] |
|
415 | cont_args = [] | |
387 | cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller')) |
|
416 | cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller')) | |
388 | if args.x: |
|
417 | ||
389 | cont_args.append('-x') |
|
418 | # Check security settings before proceeding | |
390 | if args.y: |
|
419 | keep_going = check_security(args, cont_args) | |
391 | cont_args.append('-y') |
|
420 | if not keep_going: return | |
|
421 | ||||
392 | cl = ControllerLauncher(extra_args=cont_args) |
|
422 | cl = ControllerLauncher(extra_args=cont_args) | |
393 | dstart = cl.start() |
|
423 | dstart = cl.start() | |
394 | def start_engines(r): |
|
424 | def start_engines(r): |
General Comments 0
You need to be logged in to leave comments.
Login now