Service node: a server kept running on a worker (openpanel V2)

- `service` node type: command, port, worker label, health path, env and
  weights (an artifact digest the worker fetches as {weights}). Its flow
  starts it; it restarts with backoff, reads degraded while starting or
  without a worker and down after three starts that never got healthy, and
  publishes http://<worker>:<port> once /health answers 200, "" when it ends.
- Worker protocol 3: a `serve` call, every call in its own process group,
  killed when the engine ends the call, the socket drops or the agent gets
  SIGTERM. `--service-host` overrides the address the engine sees.
- Services and compiles take no `--parallel` slot, and a flow's detail is
  built off the event loop, so a save no longer stalls the engine.
This commit is contained in:
Melvin Strobl
2026-10-19 18:43:04 +02:00
parent 80e0201612
commit 85dad39973
16 changed files with 757 additions and 34 deletions
+22
View File
@@ -285,6 +285,28 @@ Outputs the command's stdout, stderr and exit code.
In Docker, the command runs inside the backend container. Mount host files
explicitly if the command needs them.
### Service
**`service`** — keep a server running on a [remote worker](../code/workers.md#services)
for as long as its flow runs, and publish the url it listens on. Adding one
or changing its settings requires a superuser.
| Setting | Default | Notes |
|---|---|---|
| `command` | — | the server, such as `parrot serve --host 0.0.0.0 --port {port}` |
| `port` | `8100` | where the server listens, `{port}` in the command |
| `worker` | — | label of the worker to run it on, such as `gpu` |
| `health` | `/health` | path that answers 200 once the server is ready |
| `env` | `{}` | environment variables for the server |
| `weights` | — | an artifact digest, fetched to the worker as `{weights}` |
The flow starts it, so it takes no inputs. Every output port carries
`http://<worker>:<port>` once the health check answers 200, and an empty
string the moment the server stops. When it stops, it starts again after a
backoff. Its health reads `degraded` while it starts, restarts or waits for a
worker, `down` after three starts in a row that never got healthy, and `ok`
while it serves.
### File
**`file`** — read a file into the flow, or write one out of it.