Configuration Values

maelstrom-worker supports the following configuration values:

ValueTypeDescriptionDefault
brokerstringaddress of brokermust be provided
log-levelstringminimum log level"info"
cache-rootstringcache directory$XDG_CACHE_HOME/maelstrom/worker/
cache-sizestringtarget cache disk space usage"1 GB"
inline-limitstringmaximum amount of captured standard output and error"1 MB"
slotsnumberjob slots available1 per CPU

broker

The broker configuration value specifies the socket address of the broker. This configuration value must be provided. The worker will exit if it fails to connect to the broker, or when its connection to the broker terminates.

Here are some example value socket addresses:

  • broker.example.org:1234
  • 192.0.2.3:1234
  • [2001:db8::3]:1234

log-level

See here.

The worker always prints log messages to stderr.

cache-root

The cache-root configuration value specifies where the cache data will go. It defaults to $XDG_CACHE_HOME/maelstrom/worker, or ~/.cache/maelstrom/worker if XDG_CACHE_HOME isn't set. See the XDG spec for information.

cache-size

The cache-size configuration value specifies a target size for the cache. Its default value is 1 GB. When the cache consumes more than this amount of space, the worker will remove unused cache entries until the size is below this value.

It's important to note that this isn't a hard limit, and the worker will go above this amount in two cases. First, the worker always needs all of the currently-executing jobs' layers in cache. Second, the worker currently first downloads an artifact in its entirety, then adds it to the cache, then removes old values if the cache has grown too large. In this scenario, the combined size of the downloading artifact and the cache may exceed cache-size.

For these reasons, it's important to leave some wiggle room in the cache-size setting.

inline-limit

The inline-limit configuration value specifies how many bytes of stdout or stderr will be captured from jobs. Its default value is 1 MB. If stdout or stderr grows larger, the client will be given inline-limit bytes and told that the rest of the data was truncated.

In the future we will add support for the worker storing all of stdout and stderr if they exceed inline-limit. The client would then be able to download it "out of band".

slots

The slots configuration value specifies how many jobs the worker will run concurrently. Its default value is the number of CPU cores on the machine. In the future, we will add support for jobs consuming more than one slot.