### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# parallel.controller.hub

## Module: `parallel.controller.hub`

Inheritance diagram for `IPython.parallel.controller.hub`:

The IPython Controller Hub with 0MQ This is the master object that handles connections from engines and clients, and monitors traffic through the various queues.

Authors:

- Min RK

## Classes

### `EngineConnector`

class `IPython.parallel.controller.hub.``EngineConnector`(**kw)

  Bases: `IPython.utils.traitlets.HasTraits`

  A simple object for accessing the various zmq connections of an object. Attributes are: id (int): engine ID uuid (str): uuid (unused?) queue (str): identity of queue’s XREQ socket registration (str): identity of registration XREQ socket heartbeat (str): identity of heartbeat XREQ socket

  `__init__`(**kw)
  classmethod `class_trait_names`(**metadata)

    Get a list of all the names of this classes traits.

    This method is just like the `trait_names()` method, but is unbound.

  classmethod `class_traits`(**metadata)

    Get a list of all the traits of this class.

    This method is just like the `traits()` method, but is unbound.

    The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

    This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

  `control`

    A casting version of the byte string trait.

  `heartbeat`

    A casting version of the byte string trait.

  `id`

    An integer trait.

    Longs that are unnecessary (<= sys.maxint) are cast to ints.

  `on_trait_change`(handler, name=None, remove=False)

    Setup a handler to be called when a trait changes.

    This is used to setup dynamic notifications of trait changes.

    Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).

    Parameters : | handler : callable A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new). name : list, str, None If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name. remove : bool If False (the default), then install the handler. If True then unintall it.

  `pending`

    An instance of a Python set.

  `queue`

    A casting version of the byte string trait.

  `registration`

    A casting version of the byte string trait.

  `trait_metadata`(traitname, key)

    Get metadata values for trait by key.

  `trait_names`(**metadata)

    Get a list of all the names of this classes traits.

  `traits`(**metadata)

    Get a list of all the traits of this class.

    The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

    This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

### `Hub`

class `IPython.parallel.controller.hub.``Hub`(**kwargs)

  Bases: `IPython.zmq.session.SessionFactory`

  The IPython Controller Hub with 0MQ connections

  Parameters : | loop: zmq IOLoop instance : session: Session object : <removed> context: zmq context for creating new connections (?) : queue: ZMQStream for monitoring the command queue (SUB) : query: ZMQStream for engine registration and client queries requests (XREP) : heartbeat: HeartMonitor object checking the pulse of the engines : notifier: ZMQStream for broadcasting engine registration changes (PUB) : db: connection to db for out of memory logging of commands : NotImplemented engine_info: dict of zmq connection information for engines to connect : to the queues. client_info: dict of zmq connection information for engines to connect : to the queues.

  `__init__`(**kwargs)

    # universal: loop: IOLoop for creating future connections session: streamsession for sending serialized data # engine: queue: ZMQStream for monitoring queue messages query: ZMQStream for engine+client registration and client requests heartbeat: HeartMonitor object for tracking engines # extra: db: ZMQStream for db connection (NotImplemented) engine_info: zmq address/protocol dict for engine connections client_info: zmq address/protocol dict for client connections

  `all_completed`

    An instance of a Python set.

  `by_ident`

    An instance of a Python dict.

  `check_load`(client_id, msg)
  classmethod `class_config_section`()

    Get the config class config section

  classmethod `class_get_help`(inst=None)

    Get the help string for this class in ReST format.

    If inst is given, it’s current trait values will be used in place of class defaults.

  classmethod `class_get_trait_help`(trait, inst=None)

    Get the help string for a single trait.

    If inst is given, it’s current trait values will be used in place of the class default.

  classmethod `class_print_help`(inst=None)

    Get the help string for a single trait and print it.

  classmethod `class_trait_names`(**metadata)

    Get a list of all the names of this classes traits.

    This method is just like the `trait_names()` method, but is unbound.

  classmethod `class_traits`(**metadata)

    Get a list of all the traits of this class.

    This method is just like the `traits()` method, but is unbound.

    The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

    This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

  `client_info`

    An instance of a Python dict.

  `clients`

    An instance of a Python dict.

  `completed`

    An instance of a Python dict.

  `config`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `connection_request`(client_id, msg)

    Reply with connection addresses for clients.

  `context`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `db`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `db_query`(client_id, msg)

    Perform a raw query on the task record database.

  `dead_engines`

    An instance of a Python set.

  `dispatch_db`(msg)
  `dispatch_monitor_traffic`(msg)

    all ME and Task queue messages come through here, as well as IOPub traffic.

  `dispatch_query`(msg)

    Route registration requests and queries from clients.

  `engine_info`

    An instance of a Python dict.

  `engines`

    An instance of a Python dict.

  `finish_registration`(heart)

    Second half of engine registration, called after our HeartMonitor has received a beat from the Engine’s Heart.

  `get_history`(client_id, msg)

    Get a list of all msg_ids in our DB records

  `get_results`(client_id, msg)

    Get the result of 1 or more messages.

  `handle_heart_failure`(heart)

    handler to attach to heartbeater. called when a previously registered heart fails to respond to beat request. triggers unregistration

  `handle_new_heart`(heart)

    handler to attach to heartbeater. Called when a new heart starts to beat. Triggers completion of registration.

  `heartmonitor`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `hearts`

    An instance of a Python dict.

  `ids`

    An instance of a Python set.

  `incoming_registrations`

    An instance of a Python dict.

  `keytable`

    An instance of a Python dict.

  `log`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `logname`

    A trait for unicode strings.

  `loop`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `mia_task_request`(idents, msg)
  `monitor`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `notifier`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `on_trait_change`(handler, name=None, remove=False)

    Setup a handler to be called when a trait changes.

    This is used to setup dynamic notifications of trait changes.

    Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).

    Parameters : | handler : callable A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new). name : list, str, None If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name. remove : bool If False (the default), then install the handler. If True then unintall it.

  `pending`

    An instance of a Python set.

  `purge_results`(client_id, msg)

    Purge results from memory. This method is more valuable before we move to a DB based message storage mechanism.

  `query`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `queue_status`(client_id, msg)

    Return the Queue status of one or more targets. if verbose: return the msg_ids else: return len of each type. keys: queue (pending MUX jobs)

    > tasks (pending Task jobs) completed (finished jobs from both queues)

  `queues`

    An instance of a Python dict.

  `register_engine`(reg, msg)

    Register a new engine.

  `registration_timeout`

    An integer trait.

    Longs that are unnecessary (<= sys.maxint) are cast to ints.

  `resubmit`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `resubmit_task`(client_id, msg)

    Resubmit one or more tasks.

  `save_iopub_message`(topics, msg)

    save an iopub message into the db

  `save_queue_request`(idents, msg)
  `save_queue_result`(idents, msg)
  `save_task_destination`(idents, msg)
  `save_task_request`(idents, msg)

    Save the submission of a task.

  `save_task_result`(idents, msg)

    save the result of a completed task.

  `session`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `shutdown_request`(client_id, msg)

    handle shutdown request.

  `tasks`

    An instance of a Python dict.

  `trait_metadata`(traitname, key)

    Get metadata values for trait by key.

  `trait_names`(**metadata)

    Get a list of all the names of this classes traits.

  `traits`(**metadata)

    Get a list of all the traits of this class.

    The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

    This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

  `unassigned`

    An instance of a Python set.

  `unregister_engine`(ident, msg)

    Unregister an engine that explicitly requested to leave.

  `update_config`(config)

    Fire the traits events when the config is updated.

### `HubFactory`

class `IPython.parallel.controller.hub.``HubFactory`(**kwargs)

  Bases: `IPython.parallel.factory.RegistrationFactory`

  The Configurable for setting up a Hub.

  `__init__`(**kwargs)
  classmethod `class_config_section`()

    Get the config class config section

  classmethod `class_get_help`(inst=None)

    Get the help string for this class in ReST format.

    If inst is given, it’s current trait values will be used in place of class defaults.

  classmethod `class_get_trait_help`(trait, inst=None)

    Get the help string for a single trait.

    If inst is given, it’s current trait values will be used in place of the class default.

  classmethod `class_print_help`(inst=None)

    Get the help string for a single trait and print it.

  classmethod `class_trait_names`(**metadata)

    Get a list of all the names of this classes traits.

    This method is just like the `trait_names()` method, but is unbound.

  classmethod `class_traits`(**metadata)

    Get a list of all the traits of this class.

    This method is just like the `traits()` method, but is unbound.

    The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

    This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

  `client_ip`

    A trait for unicode strings.

  `client_transport`

    A trait for unicode strings.

  `config`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `construct`()
  `context`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `control`

    An instance of a Python tuple.

  `db`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `db_class`

    A string holding a valid dotted object name in Python, such as A.b3._c

  `engine_ip`

    A trait for unicode strings.

  `engine_transport`

    A trait for unicode strings.

  `hb`

    An instance of a Python tuple.

  `heartmonitor`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `init_hub`()

    construct

  `iopub`

    An instance of a Python tuple.

  `ip`

    A trait for unicode strings.

  `log`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `logname`

    A trait for unicode strings.

  `loop`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `mon_port`

    An integer trait.

    Longs that are unnecessary (<= sys.maxint) are cast to ints.

  `monitor_ip`

    A trait for unicode strings.

  `monitor_transport`

    A trait for unicode strings.

  `monitor_url`

    A trait for unicode strings.

  `mux`

    An instance of a Python tuple.

  `notifier_port`

    An integer trait.

    Longs that are unnecessary (<= sys.maxint) are cast to ints.

  `on_trait_change`(handler, name=None, remove=False)

    Setup a handler to be called when a trait changes.

    This is used to setup dynamic notifications of trait changes.

    Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).

    Parameters : | handler : callable A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new). name : list, str, None If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name. remove : bool If False (the default), then install the handler. If True then unintall it.

  `regport`

    An integer trait.

    Longs that are unnecessary (<= sys.maxint) are cast to ints.

  `session`

    A trait whose value must be an instance of a specified class.

    The value can also be an instance of a subclass of the specified class.

  `start`()
  `task`

    An instance of a Python tuple.

  `trait_metadata`(traitname, key)

    Get metadata values for trait by key.

  `trait_names`(**metadata)

    Get a list of all the names of this classes traits.

  `traits`(**metadata)

    Get a list of all the traits of this class.

    The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

    This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

  `transport`

    A trait for unicode strings.

  `update_config`(config)

    Fire the traits events when the config is updated.

  `url`

    A trait for unicode strings.

## Functions

`IPython.parallel.controller.hub.``empty_record`()

  Return an empty dict with all record keys.

`IPython.parallel.controller.hub.``init_record`(msg)

  Initialize a TaskRecord based on a request.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »