IPython Documentation

Table Of Contents

Previous topic

parallel.factory

Next topic

testing

This Page

parallel.util

Module: parallel.util

Inheritance diagram for IPython.parallel.util:

some generic utilities for dealing with classes, urls, and serialization

Authors:

  • Min RK

Classes

Namespace

class IPython.parallel.util.Namespace

Bases: dict

Subclass of dict for attribute access to keys.

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

clear() → None. Remove all items from D.
copy() → a shallow copy of D
static fromkeys(S[, v]) → New dict with keys from S and values equal to v.

v defaults to None.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
has_key(k) → True if D has a key k, else False
items() → list of D's (key, value) pairs, as 2-tuples
iteritems() → an iterator over the (key, value) items of D
iterkeys() → an iterator over the keys of D
itervalues() → an iterator over the values of D
keys() → list of D's keys
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E], **F) → None. Update D from dict/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → list of D's values
viewitems() → a set-like object providing a view on D's items
viewkeys() → a set-like object providing a view on D's keys
viewvalues() → an object providing a view on D's values

ReverseDict

class IPython.parallel.util.ReverseDict(*args, **kwargs)

Bases: dict

simple double-keyed subset of dict methods.

__init__(*args, **kwargs)
clear() → None. Remove all items from D.
copy() → a shallow copy of D
static fromkeys(S[, v]) → New dict with keys from S and values equal to v.

v defaults to None.

get(key, default=None)
has_key(k) → True if D has a key k, else False
items() → list of D's (key, value) pairs, as 2-tuples
iteritems() → an iterator over the (key, value) items of D
iterkeys() → an iterator over the keys of D
itervalues() → an iterator over the values of D
keys() → list of D's keys
pop(key)
popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E], **F) → None. Update D from dict/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → list of D's values
viewitems() → a set-like object providing a view on D's items
viewkeys() → a set-like object providing a view on D's keys
viewvalues() → an object providing a view on D's values

Functions

IPython.parallel.util.connect_engine_logger(context, iface, engine, loglevel=10)
IPython.parallel.util.connect_logger(logname, context, iface, root='ip', loglevel=10)
IPython.parallel.util.disambiguate_ip_address(ip, location=None)

turn multi-ip interfaces ‘0.0.0.0’ and ‘*’ into connectable ones, based on the location (default interpretation of location is localhost).

IPython.parallel.util.disambiguate_url(url, location=None)

turn multi-ip interfaces ‘0.0.0.0’ and ‘*’ into connectable ones, based on the location (default interpretation is localhost).

This is for zeromq urls, such as tcp://*:10101.

IPython.parallel.util.generate_exec_key(keyfile)
IPython.parallel.util.integer_loglevel(loglevel)
IPython.parallel.util.interactive(f)

decorator for making functions appear as interactively defined. This results in the function being linked to the user_ns as globals() instead of the module globals().

IPython.parallel.util.is_url(url)

boolean check for whether a string is a zmq url

IPython.parallel.util.local_logger(logname, loglevel=10)
IPython.parallel.util.log_errors(f)

decorator to log unhandled exceptions raised in a method.

For use wrapping on_recv callbacks, so that exceptions do not cause the stream to be closed.

IPython.parallel.util.select_random_ports(n)

Selects and return n random ports that are available.

IPython.parallel.util.signal_children(children)

Relay interupt/term signals to children, for more solid process cleanup.

IPython.parallel.util.split_url(url)

split a zmq url (tcp://ip:port) into (‘tcp’,’ip’,’port’).

IPython.parallel.util.validate_url(url)

validate a url for zeromq

IPython.parallel.util.validate_url_container(container)

validate a potentially nested collection of urls.