IPython Documentation

Table Of Contents

Previous topic

parallel.controller.dictdb

Next topic

parallel.controller.hub

This Page

parallel.controller.heartmonitor

Module: parallel.controller.heartmonitor

Inheritance diagram for IPython.parallel.controller.heartmonitor:

A multi-heart Heartbeat system using PUB and XREP sockets. pings are sent out on the PUB, and hearts are tracked based on their XREQ identities.

Authors:

  • Min RK

Classes

Heart

class IPython.parallel.controller.heartmonitor.Heart(in_addr, out_addr, in_type=2, out_type=5, heart_id=None)

Bases: object

A basic heart object for responding to a HeartMonitor. This is a simple wrapper with defaults for the most common Device model for responding to heartbeats.

It simply builds a threadsafe zmq.FORWARDER Device, defaulting to using SUB/XREQ for in/out.

You can specify the XREQ’s IDENTITY via the optional heart_id argument.

__init__(in_addr, out_addr, in_type=2, out_type=5, heart_id=None)
device = None
id = None
start()

HeartMonitor

class IPython.parallel.controller.heartmonitor.HeartMonitor(**kwargs)

Bases: IPython.config.configurable.LoggingConfigurable

A basic HeartMonitor class pingstream: a PUB stream pongstream: an XREP stream period: the period of the heartbeat in milliseconds

__init__(**kwargs)
add_heart_failure_handler(handler)

add a new handler for heart failure

add_new_heart_handler(handler)

add a new handler for new hearts

beat()
classmethod class_config_section()

Get the config class config section

classmethod class_get_help()

Get the help string for this class in ReST format.

classmethod class_get_trait_help(trait)

Get the help string for a single trait.

classmethod class_print_help()

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.

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.

created = None
handle_heart_failure(heart)
handle_new_heart(heart)
handle_pong(msg)

a heart just beat

hearts

An instance of a Python set.

last_ping

A casting version of the float trait.

lifetime

A casting version of the float trait.

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.

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.

on_probation

An instance of a Python set.

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.

period

A casting version of the float trait.

pingstream

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.

pongstream

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.

responses

An instance of a Python set.

start()
tic

A casting version of the float 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.