Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use multiprocessing instead of inspect to prevent spurious controllers

multiprocessing provides a cleaner check for whether the call is being made from a subprocess.
  • Loading branch information...
commit 3d64c96440751be38fe2a61400134eec3609457e 1 parent fab64a3
@minrk authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 IPython/parallel/apps/ipcontrollerapp.py
View
13 IPython/parallel/apps/ipcontrollerapp.py
@@ -412,12 +412,13 @@ def launch_new_instance():
# this only comes up when IPython has been installed using vanilla
# setuptools, and *not* distribute.
- import inspect
- for record in inspect.stack():
- frame = record[0]
- if frame.f_locals.get('__name__') == '__parents_main__':
- # we are a subprocess, don't start another Controller!
- return
+ import multiprocessing
+ p = multiprocessing.current_process()
+ # the main process has name 'MainProcess'
+ # subprocesses will have names like 'Process-1'
+ if p.name != 'MainProcess':
+ # we are a subprocess, don't start another Controller!
+ return
app = IPControllerApp.instance()
app.initialize()
app.start()
Please sign in to comment.
Something went wrong with that request. Please try again.