# Module: `parallel.controller.heartmonitor`

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

Authors:

- Min RK

## 2 Classes

class `IPython.parallel.controller.heartmonitor.``Heart`(in_addr, out_addr, mon_addr=None, in_type=2, out_type=5, mon_type=1, 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/DEALER for in/out.

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

  `__init__`(in_addr, out_addr, mon_addr=None, in_type=2, out_type=5, mon_type=1, heart_id=None)

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

  Bases: `IPython.config.configurable.LoggingConfigurable`

  A basic HeartMonitor class pingstream: a PUB stream pongstream: an ROUTER 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

  `handle_pong`(msg)

    a heart just beat