class_docstr: 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 (ROUTER)
  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.
class_docstr_tok: ["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","(","ROUTER",")","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","."]
docstr: # 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
docstr_tok: ["#","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"]
code: def __init__(self, **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
      """
  
      super().__init__(**kwargs)
  
      # register our callbacks
      self.query.on_recv(self.dispatch_query)
      self.monitor.on_recv(self.dispatch_monitor_traffic)
  
      self.monitor_handlers = {
          b"in": self.save_queue_request,
          b"out": self.save_queue_result,
          b"intask": self.save_task_request,
          b"outtask": self.save_task_result,
          b"inbcast": self.save_broadcast_request,
          b"outbcast": self.save_broadcast_result,
          b"tracktask": self.save_task_destination,
          b"incontrol": _passer,
          b"outcontrol": _passer,
          b"iopub": self.monitor_iopub_message,
          b"heartmonitor": self.heartmonitor_message,
      }
  
      self.query_handlers = {
          "queue_request": self.queue_status,
          "result_request": self.get_results,
          "history_request": self.get_history,
          "db_request": self.db_query,
          "purge_request": self.purge_results,
          "load_request": self.check_load,
          "resubmit_request": self.resubmit_task,
          "shutdown_request": self.shutdown_request,
          "registration_request": self.register_engine,
          "unregistration_request": self.unregister_engine,
          "connection_request": self.connection_request,
          "become_dask_request": self.become_dask,
          "stop_distributed_request": self.stop_distributed,
      }
  
      # ignore resubmit replies
      self.resubmit.on_recv(lambda msg: None, copy=False)
  
      self.log.info("hub::created hub")
  
imports: import inspect
  import json
  import os
  import sys
  import time
  from collections import deque
  from datetime import datetime
  import zmq
  from jupyter_client.jsonutil import parse_date
  from jupyter_client.session import Session
  from tornado import ioloop
  from traitlets import Any, Bytes, Dict, Float, HasTraits, Instance, Integer, Set, Unicode, default
  from traitlets.config import LoggingConfigurable
  from zmq.eventloop.zmqstream import ZMQStream
  from ipyparallel import error, util
  from ..util import extract_dates
  from .heartmonitor import HeartMonitor
label_desc: Use image node_id 3 to create a new Hub object from inherited base classes: LoggingConfigurable with example: obj = Hub()