cellmap_flow.serving.restart_token

The shared secret that authorizes restarting a finetune job over HTTP.

A job’s embedded inference server accepts POST /__control__/restart, and a restart can change what the job trains on, so it must not be callable by anyone who can reach the node. The job manager writes a random token into the job’s output directory before submitting it, readable only by the user; the training process reads it from there and the dashboard sends it with every restart. It never goes on the command line, where bjobs -l would show it to other users of the cluster.

Attributes

TOKEN_FILE

TOKEN_HEADER

Functions

write_restart_token(→ str)

Create a new token in output_dir (mode 0600) and return it.

read_restart_token(→ Optional[str])

The token in output_dir, or None if there is none.

read_or_create_restart_token(→ str)

The job's token, creating one for runs the job manager did not launch.

tokens_match(→ bool)

Module Contents

cellmap_flow.serving.restart_token.TOKEN_FILE = 'restart_token'
cellmap_flow.serving.restart_token.TOKEN_HEADER = 'X-Restart-Token'
cellmap_flow.serving.restart_token.write_restart_token(output_dir) → str

Create a new token in output_dir (mode 0600) and return it.

cellmap_flow.serving.restart_token.read_restart_token(output_dir) → str | None

The token in output_dir, or None if there is none.

cellmap_flow.serving.restart_token.read_or_create_restart_token(output_dir) → str

The job’s token, creating one for runs the job manager did not launch.

cellmap_flow.serving.restart_token.tokens_match(expected: str | None, provided: str | None) → bool