[IPython-User] starting ipcluster from inside an IPython session

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[IPython-User] starting ipcluster from inside an IPython session

Ian Stokes-Rees

I would like to debug a "file not found" exception that I'm getting on my controller in ipcluster. It seems like the best way to do this would be to "execute" the ipcluster command from inside an IPython session with %pdb on, however I'm stumped as to why I can't execute the equivalent ipcluster app setup from within IPython. All ipcluster does is:

from IPython.parallel.apps.ipclusterapp import launch_new_instance

launch_new_instance()

and all launch_new_instance() does i:

def launch_new_instance():
    """Create and run the IPython cluster."""
    app = IPClusterApp.instance()
    app.initialize()
    app.start()

But when I try to execute this, the very first app = IPClusterApp.instance() instruction results in the error message:

MultipleInstanceError: Multiple incompatible subclass instances of IPClusterApp are being created.

Can anyone shed light on this problem?

Thanks!

Ian


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: starting ipcluster from inside an IPython session

MinRK



On Fri, Apr 12, 2013 at 3:04 PM, Ian Stokes-Rees <[hidden email]> wrote:

I would like to debug a "file not found" exception that I'm getting on my controller in ipcluster. It seems like the best way to do this would be to "execute" the ipcluster command from inside an IPython session with %pdb on, however I'm stumped as to why I can't execute the equivalent ipcluster app setup from within IPython. All ipcluster does is:

from IPython.parallel.apps.ipclusterapp import launch_new_instance

launch_new_instance()

and all launch_new_instance() does i:

def launch_new_instance():
    """Create and run the IPython cluster."""
    app = IPClusterApp.instance()
    app.initialize()
    app.start()

But when I try to execute this, the very first app = IPClusterApp.instance() instruction results in the error message:

MultipleInstanceError: Multiple incompatible subclass instances of IPClusterApp are being created.

Can anyone shed light on this problem?


You cannot have multiple 'Application' instances in one process.  If you want to start ipcluster from IPython, it may be best to just call out to the command-line with:

! ipcluster start -n 4 --daemon

Then stop it later with:

! ipcluster stop

 

Thanks!

Ian


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user



_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: starting ipcluster from inside an IPython session

Ian Stokes-Rees

On 4/12/13 6:11 PM, MinRK wrote:

You cannot have multiple 'Application' instances in one process.  If you want to start ipcluster from IPython, it may be best to just call out to the command-line with:

! ipcluster start -n 4 --daemon

Then stop it later with:

! ipcluster stop

Right, except that I get a stack trace inside of ipcluster, and I want to be able to use pdb to debug it. So is the answer then for me to use vanilla python? Gets me part of the way, but it looks like the stack trace is being returned by some exec or perhaps even something happening on one of the "engine" nodes that is complaining about files not being available. I am running it with:

>>> import pdb
>>> import IPython.parallel.apps.ipclusterapp as ipa
>>> 
>>> import sys
>>> sys.argv= ["ipcluster", "start", "--profile=wakari"]
>>> app = ipa.IPClusterApp.instance()
>>> app.initialize()
2013-04-13 02:17:45,234.234 [IPClusterStart] Using existing profile dir: u'/user_home/w_ijstokes/code/wakari-backend/ops/automation/ipcluster/profile_wakari'
>>> pdb.run('app.start()')

But I still get back this error:

2013-04-13 02:18:58.560 [IPClusterStart] sending /user_home/w_ijstokes/code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-client.json to 2.ipcluster.wakari.io:code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-client.json
2013-04-13 02:18:59.082 [IPClusterStart] sending /user_home/w_ijstokes/code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-engine.json to 2.ipcluster.wakari.io:code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-engine.json
ERROR:root:Error in delayed callback
Traceback (most recent call last):
  File "/opt/anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 554, in _run
    self.callback()
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py", line 353, in start_engines
    self.engine_launcher.start(self.n)
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", line 781, in start
    d = el.start(user=user, hostname=host)
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", line 637, in start
    super(SSHLauncher, self).start()
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", line 272, in start
    cwd=self.work_dir
  File "/opt/anaconda/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/opt/anaconda/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Any suggestions how to figure out what is going wrong?

TIA!

Ian


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: starting ipcluster from inside an IPython session

MinRK
turn up the log level to see the command that's failing (ipcluster start --debug, or app.log_level = logging.DEBUG).  Odds are the path to ipengine is wrong.


On Fri, Apr 12, 2013 at 3:21 PM, Ian Stokes-Rees <[hidden email]> wrote:

On 4/12/13 6:11 PM, MinRK wrote:

You cannot have multiple 'Application' instances in one process.  If you want to start ipcluster from IPython, it may be best to just call out to the command-line with:

! ipcluster start -n 4 --daemon

Then stop it later with:

! ipcluster stop

Right, except that I get a stack trace inside of ipcluster, and I want to be able to use pdb to debug it. So is the answer then for me to use vanilla python? Gets me part of the way, but it looks like the stack trace is being returned by some exec or perhaps even something happening on one of the "engine" nodes that is complaining about files not being available. I am running it with:

>>> import pdb
>>> import IPython.parallel.apps.ipclusterapp as ipa
>>> 
>>> import sys
>>> sys.argv= ["ipcluster", "start", "--profile=wakari"]
>>> app = ipa.IPClusterApp.instance()
>>> app.initialize()
2013-04-13 02:17:45,234.234 [IPClusterStart] Using existing profile dir: u'/user_home/w_ijstokes/code/wakari-backend/ops/automation/ipcluster/profile_wakari'
>>> pdb.run('app.start()')

But I still get back this error:

2013-04-13 02:18:58.560 [IPClusterStart] sending /user_home/w_ijstokes/code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-client.json to 2.ipcluster.wakari.io:code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-client.json
2013-04-13 02:18:59.082 [IPClusterStart] sending /user_home/w_ijstokes/code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-engine.json to 2.ipcluster.wakari.io:code/wakari-backend/ops/automation/ipcluster/profile_wakari/security/ipcontroller-engine.json
ERROR:root:Error in delayed callback
Traceback (most recent call last):
  File "/opt/anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 554, in _run
    self.callback()
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/ipclusterapp.py", line 353, in start_engines
    self.engine_launcher.start(self.n)
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", line 781, in start
    d = el.start(user=user, hostname=host)
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", line 637, in start
    super(SSHLauncher, self).start()
  File "/opt/anaconda/lib/python2.7/site-packages/IPython/parallel/apps/launcher.py", line 272, in start
    cwd=self.work_dir
  File "/opt/anaconda/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/opt/anaconda/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Any suggestions how to figure out what is going wrong?

TIA!

Ian



_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user