kernel.controllerservice

Module: kernel.controllerservice

Inheritance diagram for IPython.kernel.controllerservice:

A Twisted Service for the IPython Controller.

The IPython Controller:

  • Listens for Engines to connect and then manages access to those engines.
  • Listens for clients and passes commands from client to the Engines.
  • Exposes an asynchronous interfaces to the Engines which themselves can block.
  • Acts as a gateway to the Engines.

The design of the controller is somewhat abstract to allow flexibility in how the controller is presented to clients. This idea is that there is a basic ControllerService class that allows engines to connect to it. But, this basic class has no client interfaces. To expose client interfaces developers provide an adapter that makes the ControllerService look like something. For example, one client interface might support task farming and another might support interactive usage. The important thing is that by using interfaces and adapters, a single controller can be accessed from multiple interfaces. Furthermore, by adapting various client interfaces to various network protocols, each client interface can be exposed to multiple network protocols. See multiengine.py for an example of how to adapt the ControllerService to a client interface.

Classes

ControllerAdapterBase

class IPython.kernel.controllerservice.ControllerAdapterBase(controller)

Bases: object

All Controller adapters should inherit from this class.

This class provides a wrapped version of the IControllerBase interface that can be used to easily create new custom controllers. Subclasses of this will provide a full implementation of IControllerBase.

This class doesn’t implement any client notification mechanism. That is up to subclasses.

__init__(controller)
on_n_engines_registered_do(n, f, *args, **kwargs)
on_register_engine_do(f, includeID, *args, **kwargs)
on_register_engine_do_not(f)
on_unregister_engine_do(f, includeID, *args, **kwargs)
on_unregister_engine_do_not(f)
register_engine(remoteEngine, id=None, ip=None, port=None, pid=None)
unregister_engine(id)

ControllerService

class IPython.kernel.controllerservice.ControllerService(maxEngines=511, saveIDs=False)

Bases: object, twisted.application.service.Service

A basic Controller represented as a Twisted Service.

This class doesn’t implement any client notification mechanism. That is up to adapted subclasses.

__init__(maxEngines=511, saveIDs=False)
on_n_engines_registered_do(n, f, *args, **kwargs)
on_register_engine_do(f, includeID, *args, **kwargs)
on_register_engine_do_not(f)
on_unregister_engine_do(f, includeID, *args, **kwargs)
on_unregister_engine_do_not(f)
register_engine(remoteEngine, id=None, ip=None, port=None, pid=None)
Register new engine connection
unregister_engine(id)
Unregister engine by id.

IControllerBase

class IPython.kernel.controllerservice.IControllerBase(name, bases=(), attrs=None, __doc__=None, __module__=None)

Bases: IPython.kernel.controllerservice.IControllerCore

The basic controller interface.

static __init__(name, bases=(), attrs=None, __doc__=None, __module__=None)

IControllerCore

class IPython.kernel.controllerservice.IControllerCore(name, bases=(), attrs=None, __doc__=None, __module__=None)

Bases: zope.interface.Interface

Basic methods any controller must have.

This is basically the aspect of the controller relevant to the engines and does not assume anything about how the engines will be presented to a client.

static __init__(name, bases=(), attrs=None, __doc__=None, __module__=None)