Jobs#

The jobs command group starts an HTTP server and provides CLI clients for submitting and streaming workloads.

Subcommands#

CommandDescription
edg jobs serveStart the HTTP server on port 3000
edg jobs submitSubmit a workload config to the server
edg jobs status [id]Show status of one or all jobs
edg jobs stream <id>Stream live progress from a running job
edg jobs healthCheck job server health

Server#

Start the job server:

edg jobs serve

The server exposes five endpoints:

MethodPathDescription
GET/healthzHealth check (returns ok)
POST/jobsSubmit a YAML workload config
GET/jobsList all jobs and their statuses
GET/jobs/{id}Check job status
GET/jobs/{id}/streamStream live progress via SSE

Submit#

Submit a workload config from the CLI:

edg jobs submit \
  --url "postgres://root@localhost:26257?sslmode=disable" \
  --driver pgx \
  --config workload.yaml \
  --duration 30s \
  --workers 4

The response contains the job ID:

{"id":"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"}

Submit flags#

FlagShortDefaultDescription
--server-shttp://localhost:3000Job server address
--duration-d1mRun duration
--workers-w1Number of concurrent workers
--streamfalseStream live logs after submitting

Global flags like --url, --driver, --config, --errors, --retries, --pool-size, and --no-atomic-tx are forwarded to the server. See CLI Reference for details.

Stream#

Stream live progress logs from a running job:

edg jobs stream a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d

The connection stays open until the job completes. Progress stats are printed to stdout as they arrive.

Alternatively, pass --stream to submit to stream automatically without needing the job ID:

edg jobs submit \
  --url "postgres://root@localhost:26257?sslmode=disable" \
  --config workload.yaml \
  --stream

Stream flags#

FlagShortDefaultDescription
--server-shttp://localhost:3000Job server address

Status#

Query job status via CLI or HTTP.

All jobs#

edg jobs status
curl http://localhost:3000/jobs
[
  {
    "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
    "status": "running",
    "started_at": "2025-04-23T14:32:07Z"
  },
  {
    "id": "f6e5d4c3-b2a1-4f6e-8d7c-9a0b1c2d3e4f",
    "status": "completed",
    "started_at": "2025-04-23T14:30:00Z",
    "completed_at": "2025-04-23T14:30:30Z"
  }
]

Single job#

edg jobs status a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
curl http://localhost:3000/jobs/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d

While running:

{
  "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
  "status": "running",
  "started_at": "2025-04-23T14:32:07Z"
}

After completion:

{
  "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
  "status": "completed",
  "started_at": "2025-04-23T14:32:07Z",
  "completed_at": "2025-04-23T14:32:37Z"
}

If the workload fails:

{
  "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
  "status": "failed",
  "error": "connecting to database: ...",
  "started_at": "2025-04-23T14:32:07Z",
  "completed_at": "2025-04-23T14:32:07Z"
}

Status flags#

FlagShortDefaultDescription
--server-shttp://localhost:3000Job server address

Health Check#

edg jobs health
curl http://localhost:3000/healthz
ok

Health flags#

FlagShortDefaultDescription
--server-shttp://localhost:3000Job server address

Lifecycle#

The server automatically runs up, seed, deseed, and down lifecycle sections if defined in the config. This means a single config file can create tables, seed data, run the workload, and clean up.

Jobs are stored in memory. Restarting the server clears all job history.