run

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 21 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 launches an agent under a budget and turns its usage into rows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentFor

func AgentFor(argv []string) (adapter.Agent, error)

AgentFor picks the adapter by the command's name.

Types

type Options

type Options struct {
	Argv   []string
	Budget decimal.Decimal
	// BillingAccount fills BillingAccountId. Empty reads unknown.
	BillingAccount string
	// Credential fills SubAccountId. Empty reads null.
	Credential string
	// CI is what the CI system says about the run. Its tags are claims: the
	// rows stay unverified and unattributed until a server checks them.
	CI      cicontext.Context
	Rows    io.Writer
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	Catalog *catalog.Catalog
	// Now is the clock. Nil means time.Now.
	Now func() time.Time
	// Grace is how long a stopped agent has before SIGKILL.
	Grace time.Duration
}

Options describes one run.

type Result

type Result struct {
	Agent       string
	AgentExit   int
	Stopped     bool
	Enforcement adapter.Enforcement
	Report      adapter.Report
	Rows        int
	ListTotal   decimal.Decimal
}

Result is what the run came to.

func Record

func Record(opts Options, agent string, report adapter.Report) (Result, error)

Record writes the rows of a run that has already ended. The report's own grade stands, because no process was watched.

func Run

func Run(ctx context.Context, opts Options) (Result, error)

Run starts the agent, reads its stream, stops it at the cap when the plan watches the run, and writes the rows at the grade the run earned.

Jump to

Keyboard shortcuts

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