pyrlang.node_db

The nodes of this Python process, by name.

class pyrlang.node_db.NodeDB

Bases: object

A singleton class for keeping track of the nodes that created withing a python process.

Even though it’s considered a bit of an anti pattern to run several nodes in one python process, we created this db class to inhibit that behaviour by default but still give some options if you really know what you’re doing.

get_all()

return the dict of registered nodes

get(node_name=None)

Get the active node or the one specified

get_loop(node_name=None)

Get the event loop for the active node, or the one specified

register(node)

registers and sets the node as the active one

activate(node)

set the node as active one.

Can’t be done if there already exists an active node, so that one needs to be deactivated first

deactivate(node)

Remove the node as the active one

This should typically not be done and exists for edge test cases and strange things.

remove(node)

Remove the node from the db