run

package
v2.0.0-beta.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckID

func CheckID(id string) error

CheckID refuses ids that would not make clean container names and paths.

func Claim

func Claim(dir string) error

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

func ClearName(ctx context.Context, dk *docker.Client, name string) error

ClearName removes a stopped container that holds name (left by a crashed run) and refuses a running one.

func ContainerName

func ContainerName(id string) string

ContainerName is the container of run id.

func CopyExecutable

func CopyExecutable(dir, name string) error

CopyExecutable copies this program into dir, for the container to run.

func CopyFile

func CopyFile(src, dst string, mode os.FileMode) error

CopyFile copies a file with mode.

func Follow

func Follow(ctx context.Context, name string, w io.Writer)

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

func ModelSHA256(dir string) (string, error)

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.

func SyncFS

func SyncFS(dir string) error

SyncFS flushes the filesystem holding dir. A bake ends with it so the gigabytes it just wrote are on disk before the next container starts: otherwise `docker create` waits for that writeback (v1 P138: 40 s).

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

func Spawn(ctx context.Context, s Child) (*Container, error)

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

func (c *Container) EngineAlive(ctx context.Context) error

EngineAlive fails when the engine process is gone.

func (*Container) EngineLog

func (c *Container) EngineLog(n int) string

EngineLog is the last lines of the engine's own log in the workspace.

func (*Container) Remove

func (c *Container) Remove()

Remove kills what is left and closes the agent connection.

func (*Container) ReplyThrough

func (c *Container) ReplyThrough(guest string)

ReplyThrough has the engine's RPC results come back as files under the IO directory, which the engine sees at guest: a data-parallel engine answers /collective_rpc for its first replica only.

func (*Container) Running

func (c *Container) Running(ctx context.Context) error

Running fails when the agent has stopped, with its last log lines.

func (*Container) SaveLogs

func (c *Container) SaveLogs(name string)

SaveLogs writes the agent's whole log to name.

func (*Container) Step

func (c *Container) Step(ctx context.Context, step string, args, out any) error

Step runs one agent step.

func (*Container) Stop

func (c *Container) Stop(grace time.Duration) error

Stop asks the agent to stop and gives it grace.

func (*Container) Tail

func (c *Container) Tail(n int) string

Tail is the agent's last log lines.

func (*Container) Wait

func (c *Container) Wait(ctx context.Context) (int, error)

Wait waits for the agent to stop and returns its exit code.

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

func NewProgress(w io.Writer, format string) *Progress

NewProgress starts the clock.

func (*Progress) Elapsed

func (p *Progress) Elapsed() float64

Elapsed is the seconds since the start.

func (*Progress) Marker

func (p *Progress) Marker(format string, args ...any)

Marker writes a line as is, at the start of the line, for scripts that grep for it ("serving started 41.2s").

func (*Progress) Printf

func (p *Progress) Printf(format string, args ...any)

Printf logs an event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL