Update design notes on runner api

This commit is contained in:
Joscha 2023-08-10 16:16:59 +02:00
parent 9ff95a2c10
commit e03617edda

View file

@ -66,34 +66,29 @@ think them through.
## Runner interaction ## Runner interaction
Runner interaction happens via endpoints located at `/api/runner/`. All of these Runner interaction happens via endpoints located at `/api/runner/`. All of these
are behind BASIC authentication with a token the runner must present. Once the are behind BASIC authentication. The username is `runner` and the password must
runner presents the correct token, the server trusts the data the runner sends, be the server's runner token. When the runner presents the correct token, the
including the name, current state, and run ids. server trusts the data the runner sends, including the name, current state, and
run ids.
On the server side, runners are identified by the runner's self-reported On the server side, runners are identified by the runner's self-reported
identifier. This allows more permanent links to runners than something like identifier. This allows more human-readable and permanent links to runners than
session ids. something like session ids.
- POST `/api/runner/update` - POST `/api/runner/status`
- Main endpoint for runner/server coordination - Main endpoint for runner/server coordination
- Runner periodically sends current status to server - Runner periodically sends current status to server
- Includes a token randomly chosen by the runner - Includes a secret randomly chosen by the runner
- Subsequent requests must include exactly the same token - Subsequent requests must include exactly the same secret
- Protects against the case where multiple runners share the same name - Protects against the case where multiple runners share the same name
- Runner may include request for new task - Runner may include request for new work
- If so, server may respond with a new task - If so, server may respond with a commit hash and bench method
- The new task includes a run id along with commit info - Runner may include current work
- Runner may include task it is currently working on - If so, server may respond with request to abort the work
- If so, server may respond with request to abort task - GET `/api/runner/repo/<hash>/tar`
- GET `/api/runner/bench` - Get tar-ed commit from the server's repo, if any exists
- Get current bench script specification - GET `/api/runner/bench-repo/<hash>/tar`
- One of: Built-in, command, path-in-project, path-in-dir? - Get tar-ed commit from the server's bench repo, if any exist
- GET `/api/runner/bench/tar`
- If bench script is path-in-dir, get the dir files here
- GET `/api/runner/run/<rid>/tar`
- Download tar of worktree for specified run
- GET `/api/runner/run/<rid>/submit`
- Submit data when a run is done
## CLI Args ## CLI Args