staging

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: AGPL-3.0 Imports: 13 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 staging implements the stage_locally path delivery: copying job inputs to worker-local scratch before a task runs and outputs back afterward. sqi never copies bytes itself; it invokes an operator-configured sync command per path. The scratch destination paths are returned as path-map rules so the other deliveries advertise them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stager

type Stager struct {
	// contains filtered or unexported fields
}

Stager copies staged paths via an external sync command, or the built-in copy when unconfigured/defaults are enabled.

func New

func New(scratchBase, syncCommand string, defaults bool, logger *slog.Logger) *Stager

New returns a Stager. scratchBase/syncCommand come from worker config; defaults enables the built-in copy + TEMP scratch when staging is otherwise unconfigured.

func (*Stager) Cleanup

func (s *Stager) Cleanup(scratchDir string)

Cleanup removes the scratch directory, logging (not returning) any error.

func (*Stager) Configured

func (s *Stager) Configured() bool

Configured reports whether staging can proceed: explicitly configured (scratch + shell command), or the built-in copy is available (defaults on, or the `builtin` sentinel was set explicitly).

func (*Stager) StageIn

func (s *Stager) StageIn(ctx context.Context, jobID, attemptID string, entries []protocol.StageEntry) ([]protocol.PathMapRule, string, error)

StageIn prepares a per-attempt scratch directory for every staged entry and returns one path-map rule per entry (original path -> scratch path) plus the scratch directory. IN/INOUT inputs are copied into scratch via the sync command; OUT entries only get their scratch destination created (the task writes the output there, and Stager.StageOut copies it back afterward). Returning a rule for OUT entries too is what lets the other deliveries redirect the task's OUTPUT paths into scratch — without it the task writes to the real path and copy-out fails on a missing scratch file. On any failure the partial scratch directory is removed.

func (*Stager) StageOut

func (s *Stager) StageOut(ctx context.Context, scratchDir string, entries []protocol.StageEntry) error

StageOut copies every OUT/INOUT entry from scratch back to its original path. It iterates the full entries slice with its original index so the per-index subdirectory (<scratchDir>/<i>/<basename>) matches what copyInEntries created.

Jump to

Keyboard shortcuts

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