Documentation
¶
Overview ¶
Package run holds what snapshot and restore share: the progress log, the run's container with its agent and engine, and the staging of files.
Index ¶
- func CheckID(id string) error
- func Claim(dir string) error
- func ClearName(ctx context.Context, dk *docker.Client, name string) error
- func ContainerName(id string) string
- func CopyExecutable(dir, name string) error
- func CopyFile(src, dst string, mode os.FileMode) error
- func Follow(ctx context.Context, name string, w io.Writer)
- func ModelSHA256(dir string) (string, error)
- func SyncFS(dir string) error
- type Child
- type Container
- func (c *Container) EngineAlive(ctx context.Context) error
- func (c *Container) EngineLog(n int) string
- func (c *Container) Remove()
- func (c *Container) Running(ctx context.Context) error
- func (c *Container) SaveLogs(name string)
- func (c *Container) Step(ctx context.Context, step string, args, out any) error
- func (c *Container) Stop(grace time.Duration) error
- func (c *Container) Tail(n int) string
- func (c *Container) Wait(ctx context.Context) (int, error)
- type Progress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Claim ¶
Claim makes dir this process's working directory for a run. A directory left by a warmctl process that is gone (it crashed or was killed) is removed first; one whose owner still runs is refused.
func ClearName ¶
ClearName removes a stopped container that holds name (left by a crashed run) and refuses a running one.
func CopyExecutable ¶
CopyExecutable copies this program into dir, for the container to run.
func Follow ¶
Follow copies the whole lines appended to name from now on to w until ctx ends: the restored engine's log, which it keeps writing in the workspace, to a pod's output.
func ModelSHA256 ¶
ModelSHA256 identifies a model directory by its file names, sizes and the bytes of every file under 4 MiB (configs, tokenizers). Weight files are identified by name and size: hashing a 500 GB checkpoint per bake buys nothing the restored weights do not prove.
Types ¶
type Child ¶
type Child struct {
Name string
Argv []string
Env []string
// IO holds the agent's sockets and Log is the engine's log file.
IO string
Log string
// AgentLog keeps the agent's output, which is copied to Output too.
AgentLog string
Output io.Writer
Ranks int
// NewUTS starts the agent in a UTS namespace of its own, where it may
// set the host name without touching the container's.
NewUTS bool
}
Child is an agent started as a child of this process: how a restore runs inside a Kubernetes pod, where no container runtime is in reach. The pod's init (tini) is PID 1 and reaps what CRIU restores.
type Container ¶
type Container struct {
Name string
// IO is the directory holding the agent's sockets, as this process
// sees it (mounted at /state in a container).
IO string
// Log is the engine's own log file, as this process sees it.
Log string
Agent *agent.Client
Engine *vllm.Engine
// contains filtered or unexported fields
}
Container is where the agent runs and the engine it drives: a Docker container under docker-init, or, inside a Kubernetes pod, a child of this process under the pod's init (Spawn).
func Launch ¶
func Launch(ctx context.Context, dk *docker.Client, spec docker.Spec, io string, ranks int) (*Container, error)
Launch creates and starts the container and connects to its agent. The engine logs into the workspace next to io.
func Spawn ¶
Spawn starts the agent and connects to it. The agent gets its own process group: only this process signals it, as only Docker signals a container.
func (*Container) EngineAlive ¶
EngineAlive fails when the engine process is gone.
func (*Container) Remove ¶
func (c *Container) Remove()
Remove kills what is left and closes the agent connection.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress writes one line per event, with the seconds since the start. Format is "plain" or "jsonl".
func NewProgress ¶
NewProgress starts the clock.