Skip to content

Operate the runner

The runner runs as its own user, yousleep-runner, with that user's services and Podman. The install script puts the command yousleep-runner on the host for operating it, and sudo yousleep-runner --help lists what it does. Each command runs with sudo to act as the runner's own user, which has no login of its own. None of them changes the host but upgrade, which installs a new release (Upgrade); service start, stop and restart change only the runner's service.

A second runner on the host, installed with --user lab-runner, say, is named first: sudo yousleep-runner --user lab-runner status.

Check the runner

Task Command
See whether the service runs sudo yousleep-runner service status
Follow the log sudo yousleep-runner logs -f
Check the host and pull the analyses' images sudo yousleep-runner doctor
Check the host only sudo yousleep-runner doctor --no-pull
Show the runner's limits sudo yousleep-runner policy
Show the runner as the Compute page shows it sudo yousleep-runner status
Print the key's fingerprint sudo yousleep-runner fingerprint
Restart the runner sudo yousleep-runner service restart

doctor, policy, status and fingerprint run in the runner's container, so they need the runner running; service and logs work either way.

doctor checks the runner's directories, the root key, Podman's version and its controllers, the connection to the platform and the host's clock, and pulls the image of each analysis the runner may be asked to run. Once the runner is approved, a runner of your site also checks your organisation's bucket from here, as the browser check does (Your own bucket), and the Storage page shows the result. Each line of its output says what it found.

status shows the runner as its administrators see it on the Compute page:

Runner     sleep-lab-1 (0193a5b2)
State      active
Version    0.26.1, update available: sudo yousleep-runner upgrade 0.27.0@sha256:…
Pool       Sleep lab
Jobs       2 running; 4 of 8 cores, 6 of 16 GiB in use
Platform   reachable; last seen 40 seconds ago

It adds a Warning line for each reason the page shows the runner in amber: it is quarantined, its job containers have a network, it has failures in a row that count towards a quarantine, it is approved but has not asked for work in the last three minutes, or your organisation's site compute is off. It adds what only the runner knows: the platform refusing it work because its version is below the platform's minimum (upgrade it), or its own image missing on this host, so it takes no ingest jobs. Each line says what to do. The log says the same when it happens, once.

While your organisation's site compute is off, the runner runs no analyses, but it still does its storage jobs: it deletes files from your bucket and reads the recordings already uploaded to it. Keep it running until those are done. An update names the upgrade command to run.

The service starts the runner again whenever it stops by itself, 15 seconds later and however often, except when the runner has been revoked (exit status 3) or is not enrolled (exit status 2): starting it again would change neither, so it stays stopped. A runner revoked while it was stopped first removes what its jobs left, their containers and directories, which hold copies of recordings. sudo yousleep-runner service status shows the status.

Send a support bundle

A support bundle is one text file with the runner's versions, identity, configuration and limits, the host checks and the recent log. Write it while the runner runs:

sudo yousleep-runner logs -n 2000 --no-pager \
  | sudo yousleep-runner support-bundle --log - > yousleep-runner-support.txt

The bundle contains no secrets that the runner knows of: the token is never stored, the key appears only as its public fingerprint, and the log is cleaned of signed links, tokens, passwords and private keys. Read the file before you send it. The log can name your recordings' files.

Configuration

install.sh writes /etc/yousleep-runner/config.toml (for another --user, the same file under /etc/ and that user's name), and config.example.toml lists every setting. An installed runner takes every setting from the file but its own image, which its unit names, and refuses to start when the environment gives another. With no file, as in a trial (Try it first), the settings come from the environment, each named after its setting in the table below in capitals: YOUSLEEP_RUNNER_API_URL for api_url, and YOUSLEEP_RUNNER_POLICY__MAX_OUTPUT_MIB for policy.max_output_mib. Separate a list's items with commas.

Setting Meaning Default
api_url The platform https://api.yousleep.ai
root_public_key The platform's root key the youSleep platform's, which the release carries; required for another platform
policy.storage_origins The storage addresses required
name The name administrators see the host's name
capacity.cores, capacity.memory_mib The cores and memory offered the host's, less one core and a quarter of the memory (at least 2 GiB)
home Where the key, the state and jobs' files live /var/lib/yousleep-runner
disk_reserve_gib The disk the runner keeps free for its host. It reports the rest of its work directory's free disk with each request for work, and the platform leases it only jobs whose files (inputs' copies and outputs) fit 10
image_cache_gib The disk the analysis images the runner pulls may take; past it, the least recently used are removed when a job ends. Its own image, any image a job holds, and any it did not pull stay 50
ca_bundle A PEM file of certificates trusted beside the public ones, relative to the configuration's directory; the install writes it with --ca-bundle. The proxy is not a setting here: the install writes it beside the configuration as proxy.env (--https-proxy) none
policy.max_job_cores, policy.max_job_memory_mib The largest single job everything offered
policy.job_kinds The kinds of job taken: analysis; ingest, which reads a new recording in the runner's own image; and delete, which removes an uploaded copy from your organisation's bucket analysis, ingest, delete
policy.batch_deletes Whether the runner takes deletes in batches: up to a few hundred files of one bucket per job, sent one after another, each reported as deleted or not; a file not deleted is tried again later as a single delete. Off, it takes them one by one on
policy.max_ingests The most ingest jobs held at once; each keeps its recording's copy on disk until it ends 4
policy.max_output_mib The largest result uploaded 1024
policy.share_log_tails Whether a job's last log lines go to the platform no
sandbox.network Whether job containers get a network. Leave it off: the platform gives a runner with it on no work, and doctor fails it off

To change a setting, run the install script again with that option (Options). The script restarts the runner, which reports its cores and memory with every request for work, so a change to capacity reaches the platform at once: it leases the runner work by the new figures, and administrators see them. It reports its storage addresses (policy.storage_origins) and the kinds of job it takes the same way, so your organisation's Storage page shows whether each runner can work with your bucket. The platform only reads them: the configuration here alone decides them.

When a job's transfer or pull fails

  • Transfers: after a network fault, or storage answering 408, 429 or 5xx, the runner tries an input's download or an output's upload three more times, after 2, 10 and 30 seconds.
  • Pulls: a failed image pull is tried twice more, after 10 and 30 seconds. A pull the registry refused, or of an image it does not know, is not tried again.
  • Giving a job back: a job whose image would not pull, whose input would not download, or whose container Podman could not start goes back to the platform. Repeated ones on jobs' first tries quarantine the runner until youSleep releases it: once its host is fixed, an owner or admin asks for the release on the Compute page, which opens a conversation with youSleep in Messages. A download from your organisation's own bucket that fails does not count: the bucket answers for itself, not this host.
  • Ingests at most: a runner holding policy.max_ingests ingest jobs asks for no more until one ends, and one that takes only ingests asks for nothing meanwhile.
  • Its own image: an ingest runs in the runner's own image. While this host does not have it, the runner takes no ingest jobs, and looks for it again every five minutes, so it takes them again once the image is back, without a restart.
  • A recording that is not EDF: a job whose recording does not start with an EDF header, an ingest's or an analysis's, is returned as input_not_edf. The platform fails it at once and does not count it against the runner.
  • An input that is not there: storage that answers 404 NoSuchKey for an input has nothing at its key, deleted or moved, and the job is returned as input_missing, untried again. Any other 404, such as NoSuchBucket or a gateway's page, says nothing about the object: it is a failed download. The platform fails it at once and does not count it against the runner. A 403 is a failed download: it may be this host's clock, or a URL that expired before it was fetched. It counts, except from your organisation's own bucket, whose key your storage may have rotated or revoked.
  • Deletes: a delete sends one presigned DELETE and runs no container. A success, or a 404 NoSuchKey, which says the object is not there, ends it with exit code 0. Any other answer, after the same tries as a transfer, ends it with exit code 1 and the storage's answer or the network error's kind, and the platform tries the delete again later. That includes any other 404, such as NoSuchBucket, as the object may still be there. The URL is never logged or reported. A delete to an address outside policy.storage_origins is returned unsent.
  • An image the registry does not have: when the image's own registry answers that it has no such image (manifest unknown or name unknown), the job is returned as image_unavailable. An answer from a mirror, or from another registry your host's configuration sends the pull to, is not taken for it. The platform fails the analysis, saying its image is not available, and does not count it against the runner: the analysis names an image that is not there, which is no fault of this host. A registry may also answer so to a login that may not read a private image: if every analysis fails as not available, check that the registry login may read the analyses' images.
  • A refused pull counts: a registry that refuses the pull (unauthorized, denied, or a token request refused with 403) does not say whether the image exists, and refuses a broken registry login the same way. Such a job is returned as a failed pull, which counts. If every job fails this way, check the registry login (--registry-login) and run doctor.
  • Results too large: a result larger than policy.max_output_mib ends the run without it, and the run is not repeated.
  • Running: a job is reported running only once its container runs.
  • Dropped jobs: a job whose lease is no longer this runner's stops and posts nothing, and the log says why: the platform said so, it queued the lease again, it did not confirm the lease for an hour, or it revoked the runner. A result the platform refused, or for which it holds another, is logged as a warning.

Upgrade

The Compute page marks a runner whose release is behind with Update available. Clicking it shows the command that installs the new release, with the release's digest. Run it on the runner's host:

sudo yousleep-runner upgrade 0.26.0@sha256:DIGEST

With the digest, the command installs exactly the image the platform names; sudo yousleep-runner upgrade 0.26.0 installs the image the release's tag names when you run it. The command writes the release's install files into a directory only root can write, so nothing else on the host can change them before they run, runs its install script, and removes them. On a host with more than one runner, name the runner first, as for every command: sudo yousleep-runner --user lab-runner upgrade 0.26.0.

A host whose command does not list upgrade (sudo yousleep-runner --help) has a release from before it, and the Compute page shows these steps instead. Write the new release's install files, with its version in place of VERSION, as yourself rather than as the runner's user: the install script runs as root, so it must not run from a directory the runner's user can write. Then run the install script without options:

mkdir runner-upgrade && cd runner-upgrade
podman run --rm -v "$PWD:/out:Z" ghcr.io/yousleep-ai/runner:VERSION setup /out
sudo ./install.sh < /dev/null

Either way, the install script keeps the configuration and the enrolment, and restarts the runner. If a check fails, the runner stays on the release it had. A release can need a newer Podman than the one before it: the script then stops before it changes anything and names the version it needs. Upgrade Podman, then run the script again.

When the runner stops, it stops its jobs and hands them back to the platform, which queues them again. A runner that could not, because it was killed or its host went down, removes its jobs' containers and files when it starts again, and hands those jobs back then as left over. Each costs its job one of its tries, so a job that keeps taking its runner down fails rather than coming back without end. A job it cannot hand back, because the runner stayed down for longer than a lease or the platform did not answer, is queued again if it had not started, and fails if it had.

Remove the runner

  1. Revoke the runner on the platform: an owner or admin of your organisation does it in the runners on the Compute page. The platform refuses it from then on, and the runner stops; its service does not start it again.
  2. Stop it, and remove its user. The user's own home holds its containers, its images and its service, and goes with it:
sudo yousleep-runner service stop
sudo loginctl disable-linger yousleep-runner
sudo userdel --remove yousleep-runner

If userdel answers that the user is still in use, its services are still stopping: run it again a moment later.

  1. Remove the runner's home, its configuration and the command. Use your own home directory if you installed with --home, and keep /usr/local/bin/yousleep-runner while another runner remains on the host:
sudo rm -rf /var/lib/yousleep-runner /etc/yousleep-runner /usr/local/bin/yousleep-runner

If no other service needs the delegated controllers, also remove /etc/systemd/system/user@.service.d/yousleep-runner-delegate.conf and run sudo systemctl daemon-reload.