job

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package job is the job tier: a Base, one per job, decorates the job it builds with the job tier (recovery, logging, tracing, metrics, timeout), so a job is a function plus its name and group, never a hand-written AnyJob type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component added in v0.0.19

func Component(prefix, group, name string) string

Component is the config component name of the job name in group under prefix: prefix, then the snake_case group and name, joined with dots ("cli", "Setup", "git hooks" → "cli.setup.git_hooks").

func Tier added in v0.0.7

func Tier() decorate.Tier

Tier is the job decoration tier: recovery outermost, then logging, tracing, metrics, and the per-job timeout. A job runs as the operation "execute".

func Warn added in v0.0.19

Warn makes j advisory: it keeps j's metadata and downgrades each Fail step j reports to Warn, so j never fails its gate. An execution error (j could not run) is returned unchanged.

Types

type Base added in v0.0.7

type Base struct {
	// Subject runs the job through the tier; it supplies Name and Exec.
	decorate.Subject
}

Base is the embeddable core of one job named by its Subject: the job runs through the job tier as the operation "execute", the snake_case name of interfaces.AnyJob's Execute. Func, Local and Wrap build the job; build one job per Base, so each job is its own component in the config. The zero Base builds an undecorated job.

func NewBase added in v0.0.7

func NewBase(decs decorate.Decorations, name string) (Base, error)

NewBase builds the Base for the job named name, decorated from decs as the job-tier component name (its operation as name+".execute"). A decoration that fails to resolve is an error.

func (Base) Check added in v0.0.19

func (b Base) Check(
	name, group string,
	run func(context.Context) error,
) interfaces.AnyJob

Check builds the job name in group that runs one pass/fail check: one step named name, Pass when run returns nil, otherwise Fail carrying the error's message.

func (Base) Func added in v0.0.7

func (b Base) Func(name, group string, run Run) interfaces.AnyJob

Func builds the job name in group that runs run.

func (Base) Local added in v0.0.8

func (b Base) Local(
	name, group string,
	fn func(context.Context) (types.StepResults, error),
) interfaces.AnyJob

Local builds the job name in group that runs fn, in-process work (a seeder, a sync) that needs no command runner or root; a gate of Local jobs runs with gate.RunLocal.

func (Base) Wrap added in v0.0.7

Wrap decorates an existing job, keeping its metadata.

type Run added in v0.0.7

type Run func(
	ctx context.Context,
	runner interfaces.CommandRunner,
	root string,
) (types.StepResults, error)

Run is a job's work: it executes against runner under root and returns the job's step results.

Jump to

Keyboard shortcuts

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