Skip to content

Configuration Reference

All configuration is via environment variables, loaded from .env at startup via python-dotenv.


Required

Variable Type Description
URL_BLACKBOARD str Base URL of the workflow engine blackboard API (e.g., http://localhost:3030)
DIR_FUNCTION_BLOCKS str Comma-separated list of directories to scan for function block modules

Worker Identity

Variable Type Default Description
WORKER_NAME str None Human-readable name for this worker instance (appears in engine UI)
WORKER_IP_ADDRESS str None IP address reported to the workflow engine
NEOPS_WORKER_NETWORK_ZONES str (unset) Comma-separated network zones this worker serves, e.g. zone-b or default,zone-lab. Unset or empty, the worker serves default until the CMS holds another zone; from then on the engine refuses it at registration

The zone setting is split on commas and trimmed; empty items and repeats are dropped. The engine checks each name against the zones the CMS holds, so the worker keeps no naming rule of its own. default is a zone like any other here: a worker that should take jobs for devices without a zone lists it.

Set the zone in each worker’s own service definition

Keep NEOPS_WORKER_NETWORK_ZONES out of any .env file a remote site copies. A remote worker that misses its own setting should be refused, not quietly serve default from inside another network.


Timing

Variable Type Default Description
POLL_INTERVAL int 10 Seconds the worker waits after a poll that returned no job, or failed, before it polls again. After a job it polls again at once, see Throughput
HEARTBEAT_INTERVAL int 20 Seconds between heartbeat pings
SHUTDOWN_TIMEOUT int 60 Seconds a running job gets to finish after a shutdown request; then the worker deregisters and ends its process, stopping the job wherever it is (the engine fails it as worker-offline)
API_REQUEST_TIMEOUT int 30 Timeout in seconds for individual API requests
RESULT_PUSH_TIMEOUT int 300 Seconds to keep re-sending a job result while the engine is unreachable, see Result push and the engine’s timeouts
STARTUP_RETRY_TIMEOUT int 120 Seconds to keep retrying worker and function-block registration at startup before exiting 1

Throughput

A worker runs one job at a time. The engine hands out one job per poll, and the worker polls again as soon as it has pushed that job’s result, so while jobs wait it runs them back to back. Only a poll that returns nothing, or fails, makes it wait POLL_INTERVAL before the next one.

  • Jobs per worker per minute while jobs wait: about 60 / (t + r), with t the job’s own seconds and r the round trip of one poll and one result push.
  • Step time for a step over N devices in a zone with W workers: about N / W × (t + r), plus up to one POLL_INTERVAL before the first worker sees the step.
  • Pending timeout. The last job of such a step waits about N / W × (t + r) before a worker takes it. Keep that well below the engine’s BLACKBOARD_PENDING_JOB_TIMEOUT (60 min by default); beyond it, waiting jobs fail.

Worker SDK 0.5.0 and earlier slept 1 s and then POLL_INTERVAL after every job, also while jobs waited. With the default 10 s that capped a worker at about 60 / (11 + t) jobs a minute: 5.4 for an instant job, 1.5 for a 30 s job.

Result push and the engine’s timeouts

The engine stops taking a job’s result at the earlier of two of its timeouts:

  • WORKER_OFFLINE_THRESHOLD_MS (6 min by default), counted from the worker’s last heartbeat: the engine marks the worker offline and fails the jobs it holds;
  • BLACKBOARD_STUCK_JOB_TIMEOUT (12 min by default), counted from when the worker took the job: the engine fails the job as timed out.

The two count from different points, so for a job longer than about 6 min the stuck-job timeout fires first.

A result pushed after that is refused, and the worker logs Engine already holds a result for job …; this one is dropped. The engine may by then have given the job to another worker.

RESULT_PUSH_TIMEOUT counts from the job’s end, so it trades two losses against each other:

  • Below the earlier timeout, an outage that outlasts RESULT_PUSH_TIMEOUT but ends before the engine fails the job drops a result the engine would still take. With the defaults that is an outage starting after the job ended and lasting between 5 and about 6 min. Such an outage ends before the offline threshold, so the worker stays online and the engine fails the job later, at the stuck-job timeout (job_timed_out); only an outage that outlasts the offline threshold fails it as worker-offline (worker_lost). Either way a change the block made is reported as failed and may run again.
  • Above it, the extra re-sending can only be refused, and while it lasts the worker does not poll.

To close the window, set RESULT_PUSH_TIMEOUT to the earlier of the two timeouts, 360 with the engine’s defaults, and raise it with them. An outage longer than that fails the jobs a site’s workers hold whatever this setting is.


Diagnostics

Variable Type Default Description
BLOCKING_DETECTION_THRESHOLD float 0.5 Seconds of blocking before a warning is logged. Set to 0 to disable.
HEALTH_FILE str /tmp/neops-worker-alive File the worker touches on every poll cycle, after every job and on every heartbeat tick, read by the healthcheck. Removed at startup and on stop. Set it empty to disable.
HEALTH_STALL_TIMEOUT int 720 Seconds one job may hold up the poll loop before heartbeats stop refreshing HEALTH_FILE, so a hung job turns the worker unhealthy. The default matches the engine’s BLACKBOARD_STUCK_JOB_TIMEOUT (720000 ms, 12 min); raise the two together.

Logging

Every line goes to stdout and, unless pushing is off, to the workflow engine, which stores it in its log store and serves it in the run view. Pushing is best-effort: it never delays a job by more than one push interval and never fails one. Lines of a running job are pushed with the job’s lease (POST /blackboard/job/logs); every other line goes to POST /workers/<uuid>/logs.

Variable Type Default Description
NEOPS_LOG_LEVEL str debug Lowest level written to stdout: error, warn, info or debug
NEOPS_LOG_FORMAT str json when stdout is not a terminal, else text Stdout format. JSON lines carry the run, step, job and worker keys at the top and every other context key under fields
NEOPS_LOG_PUSH_LEVEL str info Lowest level pushed to the engine; off disables pushing
NEOPS_LOG_PUSH_INTERVAL_MS int 1000 Milliseconds between two pushes; a value below 1000 is raised to 1000 with a warning. A job’s lines are also pushed right before its result, and what is left at shutdown gets 5 s
NEOPS_LOG_PUSH_BUFFER_MAX_RECORDS int 10000 Lines held while the engine is unreachable; beyond it the oldest are dropped, and the next push says how many. A value below 5000 refuses startup
NEOPS_LOG_REDACT_EXTRA_KEYS str (unset) Comma-separated key parts masked on top of password, secret, token, passphrase and api_key, e.g. community,pin. Replaces LOG_REDACT_EXTRA_KEYS, which is no longer read
NEOPS_LOG_VERBOSE_RESULTS bool false Log the parameters and result data of every job; by default only a failed job’s are logged

A variable set to the empty string counts as unset.


Testing

Variable Type Default Description
REMOTE_LAB_URL str (unset) Base URL of the remote lab server for integration tests

CMS / GraphQL

CMS & GraphQL

The CMS provides entity data that function blocks access through WorkflowContext. CMS documentation is forthcoming. See the Glossary for a conceptual overview and the engine’s Context concept for how entity data flows into function blocks.

Variable Type Default Description
URL_GRAPHQL str None GraphQL endpoint of the neops CMS (used for data queries)

Example .env

# Required
URL_BLACKBOARD=http://localhost:3030
DIR_FUNCTION_BLOCKS=./my_function_blocks

# Worker identity
WORKER_NAME=lab-worker-01
WORKER_IP_ADDRESS=10.0.0.50

# Timing (optional — defaults are sensible for most deployments)
POLL_INTERVAL=10
HEARTBEAT_INTERVAL=20
SHUTDOWN_TIMEOUT=60

# Diagnostics
BLOCKING_DETECTION_THRESHOLD=0.5
HEALTH_FILE=/tmp/neops-worker-alive

# Logging (optional)
NEOPS_LOG_FORMAT=json
NEOPS_LOG_PUSH_LEVEL=info

# CMS
URL_GRAPHQL=http://localhost:8000/graphql