sqi-worker

command
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 52 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sqi-worker

sqi-worker is the distributed task-execution agent for the sqi render farm. It connects to a running sqi-server, registers its hardware capabilities, and requests task assignments over core-NATS work leases (work.lease.<workerID>.<queueID>), executing them as bare-metal OS processes.


What it does

  • Discovers sqi-server automatically via mDNS on the local network, or connects to an explicit NATS URL for cross-subnet and cloud deployments.
  • Registers its capabilities at startup — OS, CPU count, RAM, GPU (where detectable), plus any manual tags from configuration such as maya_2025 or arnold_7.
  • Leases task assignments over core NATS (a long-polling request/reply on work.lease.<workerID>.<queueID>) and executes them concurrently; the server gates concurrency via CPU-core accounting. Task status, logs, heartbeats and registration travel the other way over JetStream.
  • Streams task stdout and stderr back to sqi-server in real time so the web UI log viewer feels live.
  • Interprets OpenJD progress directives (openjd_progress, openjd_status, openjd_fail) from process output. Progress accepts integer or float values from 0 to 100; progress and status snapshots are throttled to one per 2 s.
  • Reports task status transitions (running → succeeded / failed / canceled) and publishes a heartbeat every 15 s so the server can detect stale workers.
  • Shuts down gracefully on SIGINT / SIGTERM: stops accepting new assignments, waits for in-flight tasks to finish (up to a configurable grace period), then force-kills any stragglers and deregisters from the server.

Minimum configuration

sqi-worker requires a way to reach sqi's NATS broker: the one embedded in sqi-server, or the external NATS cluster the server runs on. You have two options:

Option A — mDNS auto-discovery (local network, zero config)

mDNS is enabled by default. If sqi-server is running on the same LAN, no configuration is needed:

sqi-worker start

The worker browses for _sqi._tcp advertisements for up to 5 s. If it finds one, it uses that server's NATS address automatically.

Option B — explicit NATS URL (cloud, cross-subnet, or no multicast)

Create a minimal config file at config/sqi-worker.yaml next to the binary, or at ~/.sqi/sqi-worker.yaml:

nats:
  url: "nats://sqi-server.example.com:4222"

discovery:
  enable_mdns: false

Then start the worker:

sqi-worker start

Or pass the URL directly without a config file:

SQI_WORKER_NATS_URL=nats://sqi-server.example.com:4222 \
SQI_WORKER_DISCOVERY_ENABLE_MDNS=false \
  sqi-worker start

Running against a local sqi-server

Start sqi-server in one terminal (default: NATS on 0.0.0.0:4222, HTTP on 0.0.0.0:8080):

./bin/sqi-server serve

In a second terminal, start the worker pointing at it:

SQI_WORKER_NATS_URL=nats://127.0.0.1:4222 \
SQI_WORKER_DISCOVERY_ENABLE_MDNS=false \
SQI_WORKER_LOG_FORMAT=text \
SQI_WORKER_LOG_LEVEL=debug \
  ./bin/sqi-worker start

The worker logs its worker ID and the connected NATS URL at startup:

INFO sqi-worker starting worker_id=<uuid> worker_name=<hostname> ...
Verify configuration before connecting

Use --dry-run to resolve configuration, detect capabilities, and print what would be registered — without touching the server:

./bin/sqi-worker start --dry-run

Print the effective merged configuration at any time:

./bin/sqi-worker config print

Verifying registration via the web UI

Once the worker starts successfully, confirm it is registered:

  1. Open http://localhost:8080 in a browser (or wherever sqi-server is running).
  2. Navigate to Workers in the sidebar.
  3. The worker should appear with status online, its capability tags, and the number of active / maximum concurrent tasks.

You can also confirm via the REST API:

curl -s http://localhost:8080/api/v1/workers | jq '.[].name'

Quick reference

Command Description
sqi-worker start Start the worker agent
sqi-worker start --dry-run Validate config and capabilities without connecting
sqi-worker start --nats-insecure-skip-verify Skip TLS cert verification (dev only)
sqi-worker config init [--nats-url URL] Write a starter configuration file to the platform's default location (--force replaces one; --user ACCOUNT on Windows)
sqi-worker config print Print the effective merged configuration
sqi-worker capabilities Print every tag this worker would advertise, with its source
sqi-worker isolation set-credential <user> Store a run-as-user account's password (Windows; reads the secret from stdin)
sqi-worker service install|uninstall|start|stop|status Windows only: install, uninstall, start, stop and inspect the Windows service (elevated shell) — see docs/worker-deployment.md
sqi-worker version Print version, commit, build date, and Go version

Three flags are available on every subcommand: --config/-c (config file path), --log-level, and --log-format. --dry-run and --nats-insecure-skip-verify belong to start only.


See also

Documentation

Overview

Command sqi-worker is the sqi distributed task management worker agent.

It discovers and connects to a running sqi-server, registers itself with its capability tags and compute location, leases task assignments over core NATS (work.lease.<workerID>.<queueID>), and executes bare-metal OS processes inside OpenJD sessions.

Run "sqi-worker --help" for usage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL