background

package
v1.223.0-rc.11 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package background supervises workflow steps marked `background: true`: a step starts and the workflow continues while Atmos keeps it alive, later waiting for it to become ready (`wait`/`wait-all`) or tearing it down (`cancel`).

The package is intentionally generic. v1 ships a single container-backed Runner (the container runtime is the supervisor, so no goroutine is needed); a future shell/process Runner can implement the same Runner/Handle interfaces — backed by a goroutine and a readiness probe — without changing the workflow orchestration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle interface {
	// Name is the step name the background step was registered under.
	Name() string
	// WaitReady blocks until the background step is ready to use — for a container
	// service, until its health check passes — or returns immediately when no
	// readiness is configured. A service that reports terminally unhealthy fails fast.
	WaitReady(ctx context.Context) error
	// Stop gracefully tears the background step down (for a container, stop+remove).
	Stop(ctx context.Context) error
}

Handle supervises a single running background step.

type Registry

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

Registry tracks the background steps started during one workflow run, keyed by step name. It is safe for concurrent use.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty run-scoped registry.

func (*Registry) Get

func (r *Registry) Get(name string) (Handle, bool)

Get returns the handle registered under name.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns the still-registered background step names in registration order.

func (*Registry) Register

func (r *Registry) Register(h Handle)

Register records a started handle under its name, preserving first-seen order.

func (*Registry) Remove

func (r *Registry) Remove(name string)

Remove drops a handle from the registry (after it has been stopped).

func (*Registry) StopAll

func (r *Registry) StopAll(ctx context.Context) error

StopAll tears down every still-registered background step — the implicit auto-teardown at the end of a scope. It attempts every handle and joins errors so a single failure does not leak the rest.

type Runner

type Runner interface {
	Start(ctx context.Context, step *schema.WorkflowStep, env []string) (Handle, error)
}

Runner starts a background step and returns a Handle to supervise it.

Jump to

Keyboard shortcuts

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