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
- func CheckID(id string) error
- func Claim(dir string) error
- func ClaimDir(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 MergeEnv(base []string, launch map[string]string) []string
- func ModelSHA256(dir string) (string, error)
- func Place(dir, path 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) ReplyThrough(guest string)
- 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 Lock
- type Progress
- type Runtime
Constants ¶
const ContainerLock = "/"
ContainerLock is the directory an in-place run locks: the container's root, which every container has, read-only or not, and no mount of a tree hides. The run owns the container's /tmp, /dev/shm and /workspace, so a container runs one in-place run at a time.
const RuntimeFile = "/opt/warmctl/RUNTIME"
RuntimeFile marks the warmctl runtime image (deploy/kubernetes/Dockerfile): the warmctl it carries and the image it was built FROM.
const SetAside = ".warmctl-image"
SetAside is the suffix Place gives what it found at a path.
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 ClaimDir ¶
ClaimDir makes dir a tree of this run in a container warmctl did not make: it may be empty or hold what an earlier run left under its mark, which goes; anything else may be the operator's data on a volume and 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 MergeEnv ¶
MergeEnv is base with launch's variables over it, launch's sorted by name: the environment of an engine started in this container rather than in one warmctl made, as a container's is the image's plus the profile's.
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.
func Place ¶
Place makes path lead to dir without a mount, for a container that may not mount (the dmtcp backend): a symbolic link replaces an earlier link or an empty directory, and anything else at path is moved aside, once, to path+SetAside. Processes that open files through path see dir's real paths, which a DMTCP restart needs to find again.
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.
func (*Container) ReplyThrough ¶
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.
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock is an exclusive flock held for the life of a run.
func LockContainer ¶
LockContainer takes ContainerLock without waiting.
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.
type Runtime ¶
type Runtime struct {
// Warmctl is the version built into the image.
Warmctl string
// Base is the image it was built FROM, the one a snapshot's engine
// must have run in.
Base string
}
Runtime is RuntimeFile: `key=value` lines.
func ParseRuntime ¶
ParseRuntime reads RuntimeFile's text.