Documentation
¶
Overview ¶
Package workercmd is the out-of-process worker's command line: the flags, the environment it reads, and the run loop around workersdk. Both `atlas worker` and the separate `atlas-workers` executable run it (ADR-0535, migration step 2), so a worker the server supervises behaves the same whichever binary it is.
Index ¶
Constants ¶
const ExitNothingToServe = 78
ExitNothingToServe is the status a process ending in ErrNothingToServe leaves (EX_CONFIG). The supervisor reads it to park a worker rather than restart it; api defines its constant as this one, so the two ends cannot disagree.
Variables ¶
var ErrNothingToServe = errors.New("worker: nothing to serve")
ErrNothingToServe ends a worker that holds no handler at all. It leaves [exitNothingToServe] rather than a generic failure so a supervisor can tell "this worker has nothing configured yet" from "this worker crashed", and park it instead of restarting it into an empty configuration on a backoff loop.
Functions ¶
func DefaultWorkerID ¶
func DefaultWorkerID() string
DefaultWorkerID names the worker after the host it runs on, which is the useful default when several replicas each want their own row in the Workers view.
func Run ¶
Run runs this process as an out-of-process worker for a running Atlas (ADR-0157 step 5): it leases jobs of the types it was given, runs a command for each, and reports the outcome. The job arrives on the command's stdin as JSON and whatever JSON object the command prints becomes the variables the job completes with; a non-zero exit fails the job, carrying stderr as the message.
This is what takes a service task's work off the engine's single writer: the latency of the work is paid by this process, not by every other request.
Types ¶
This section is empty.