Configuration

The node

Everything is an argument of Node; the class description has the details of each.

Argument

Default

Meaning

node_name

name@host. None asks the first node this one connects to for a name (a dynamic node name, as erl -name undefined).

cookie

The shared secret; the same on all nodes.

hidden

False

A hidden node is listed by nodes(hidden) only, not by nodes().

net_ticktime

60

Seconds, as the kernel parameter of that name in Erlang: an idle connection is ticked every quarter of it, and a silent node is given up after it. Use the value of the Erlang nodes.

epmd

True

False: do not register in EPMD and do not ask it.

dist_port

0

The port other nodes connect to; 0 picks a free one.

host

host name

For a dynamic node name: the host part the name gets.

max_fragmented_size

256 MiB

A peer whose unfinished fragmented messages exceed this is disconnected.

dist_buf_busy_limit

1 MiB

When more than this waits to be sent to a node, await node.send(...) waits (Erlang’s +zdbbl).

recv_backlog_messages, recv_backlog_bytes

10 000, 32 MiB

When this much of what a node sent waits in process inboxes, reading from that node pauses, which suspends its senders.

The EPMD port is taken from the environment variable ERL_EPMD_PORT, as Erlang does; the default is 4369.

Without EPMD

node = Node("py@127.0.0.1", "COOKIE", epmd=False, dist_port=4370)
await node.wait_started()
await node.connect("erl@127.0.0.1", "127.0.0.1", 4371)

An Erlang node started with erl -name erl@127.0.0.1 -start_epmd false -erl_epmd_port 4371 listens on that port. This fragment is not run by the tests as it stands; test/test_epmd_client.py::test_connect_without_epmd does the same with free ports.

Logging

Pyrlang logs through the standard logging module under the logger pyrlang and configures nothing when it is imported. An application sets up logging itself, or calls pyrlang.util.start_pyrlang(), which reads two environment variables:

  • PYRLANG_LOG_LEVEL: CRITICAL, ERROR, WARNING, INFO, DEBUG or NOTSET; the level of the logger pyrlang.

  • PYRLANG_ENABLE_LOG_FORMAT: 1, yes, true or on installs a format with time, logger, module and line.

Cookies, challenges and digests are never logged.

Errors

Every exception Pyrlang raises derives from pyrlang.errors.PyrlangException. Bytes from the network are untrusted: a malformed packet is logged and closes that one connection, with the effect of a lost connection on links and monitors; it does not raise into your code.