IPython Documentation

Table Of Contents

Previous topic

Module: parallel.controller.dependency

Next topic

Module: parallel.controller.heartmonitor

This Page

Module: parallel.controller.dictdb

A Task logger that presents our DB interface, but exists entirely in memory and implemented with dicts.

Authors:

  • Min RK

TaskRecords are dicts of the form:

{
    'msg_id' : str(uuid),
    'client_uuid' : str(uuid),
    'engine_uuid' : str(uuid) or None,
    'header' : dict(header),
    'content': dict(content),
    'buffers': list(buffers),
    'submitted': datetime or None,
    'started': datetime or None,
    'completed': datetime or None,
    'received': datetime or None,
    'resubmitted': str(uuid) or None,
    'result_header' : dict(header) or None,
    'result_content' : dict(content) or None,
    'result_buffers' : list(buffers) or None,
}

With this info, many of the special categories of tasks can be defined by query, e.g.:

  • pending: completed is None
  • client’s outstanding: client_uuid = uuid && completed is None
  • MIA: arrived is None (and completed is None)

DictDB supports a subset of mongodb operators:

$lt,$gt,$lte,$gte,$ne,$in,$nin,$all,$mod,$exists

4 Classes

class IPython.parallel.controller.dictdb.CompositeFilter(dikt)

Bases: object

Composite filter for matching multiple properties.

__init__(dikt)
class IPython.parallel.controller.dictdb.BaseDB(**kwargs)

Bases: IPython.config.configurable.LoggingConfigurable

Empty Parent class so traitlets work on DB.

class IPython.parallel.controller.dictdb.DictDB(**kwargs)

Bases: IPython.parallel.controller.dictdb.BaseDB

Basic in-memory dict-based object for saving Task Records.

This is the first object to present the DB interface for logging tasks out of memory.

The interface is based on MongoDB, so adding a MongoDB backend should be straightforward.

add_record(msg_id, rec)

Add a new Task Record, by msg_id.

drop_matching_records(check)

Remove a record from the DB.

drop_record(msg_id)

Remove a record from the DB.

find_records(check, keys=None)

Find records matching a query dict, optionally extracting subset of keys.

Returns dict keyed by msg_id of matching records.

Parameters:

check: dict

mongodb-style query argument

keys: list of strs [optional]

if specified, the subset of keys to extract. msg_id will always be included.

get_history()

get all msg_ids, ordered by time submitted.

get_record(msg_id)

Get a specific Task Record, by msg_id.

update_record(msg_id, rec)

Update the data in an existing record.

class IPython.parallel.controller.dictdb.NoDB(**kwargs)

Bases: IPython.parallel.controller.dictdb.BaseDB

A blackhole db backend that actually stores no information.

Provides the full DB interface, but raises KeyErrors on any method that tries to access the records. This can be used to minimize the memory footprint of the Hub when its record-keeping functionality is not required.