internal

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvRunID      = "BENCHCTL_RUN_ID"
	EnvOutputDir  = "BENCHCTL_OUTPUT_DIR"
	EnvRunDir     = "BENCHCTL_RUN_DIR"
	EnvConfigPath = "BENCHCTL_CONFIG_PATH"
	EnvBenchctl   = "BENCHCTL_BIN"
	EnvCaseName   = "BENCHCTL_CASE_NAME"
	EnvHost       = "BENCHCTL_HOST"
	DefaultShell  = "bash -lic"
)
View Source
const BackgroundTerminationGrace = 2 * time.Second

BackgroundTerminationGrace defines how long we wait after SIGTERM before forcefully killing background stages.

Variables

This section is empty.

Functions

func AddMetadata added in v0.1.1

func AddMetadata(runPath string, extraMetadata map[string]string) error

func CallWithRetry

func CallWithRetry[T any](ctx context.Context, fn func() (T, error), maxAttempts int, backoff time.Duration) (T, error)

CallWithRetry calls a function, retrying maxAttempts times if it returns an error. If after maxAttempts the function still returns an error, it returns the zero value of T and the error.

func ConfigureDefaultLogger added in v0.3.0

func ConfigureDefaultLogger()

ConfigureDefaultLogger installs a human-readable slog logger on stderr.

func InspectRun added in v0.1.1

func InspectRun(runPath string, verbose bool) string

func PrintComparisonResults added in v0.1.1

func PrintComparisonResults(results []ComparisonResult) string

func SyncResults added in v0.3.0

func SyncResults(ctx context.Context, cfg *config.Config) error

SyncResults pushes the benchmark output directory to the configured rclone remote.

Types

type ComparisonResult added in v0.1.1

type ComparisonResult interface {
	GetKey() string
	GetValue1() string
	GetValue2() string
	Format() string
}

func CompareRunMetadata added in v0.1.1

func CompareRunMetadata(metadata1, metadata2 *RunMetadata) ([]ComparisonResult, error)

CompareRunMetadata compares two run metadata and returns a list of differences

type FloatComparisonResult added in v0.1.1

type FloatComparisonResult struct {
	Key    string
	Value1 *float64
	Value2 *float64
}

func (*FloatComparisonResult) Format added in v0.1.1

func (r *FloatComparisonResult) Format() string

func (*FloatComparisonResult) GetKey added in v0.1.1

func (r *FloatComparisonResult) GetKey() string

func (*FloatComparisonResult) GetValue1 added in v0.1.1

func (r *FloatComparisonResult) GetValue1() string

func (*FloatComparisonResult) GetValue2 added in v0.1.1

func (r *FloatComparisonResult) GetValue2() string

type GitMetadata added in v0.3.0

type GitMetadata struct {
	Root            string `json:"root"`
	Commit          string `json:"commit"`
	Branch          string `json:"branch,omitempty"`
	RemoteURL       string `json:"remote_url,omitempty"`
	Dirty           bool   `json:"dirty"`
	StatusPorcelain string `json:"status_porcelain,omitempty"`
	PatchPath       string `json:"patch_path,omitempty"`
}

GitMetadata describes the source repository state captured for a run.

func CaptureGitMetadata added in v0.3.0

func CaptureGitMetadata(ctx context.Context, cfg *config.Config, runDir string) (*GitMetadata, error)

CaptureGitMetadata captures git metadata for the current working directory.

type RunMetadata

type RunMetadata struct {
	RunID         string                 `json:"run_id"`
	BenchmarkName string                 `json:"benchmark_name"`
	StartTime     time.Time              `json:"start_time"`
	EndTime       time.Time              `json:"end_time"`
	Config        *config.Config         `json:"config"`
	Hosts         map[string]config.Host `json:"hosts"`
	Cases         []config.Case          `json:"cases,omitempty"`
	Custom        map[string]string      `json:"custom,omitempty"`
	Git           *GitMetadata           `json:"git,omitempty"`
	Status        string                 `json:"status"`          // "success" or "failed"
	Error         string                 `json:"error,omitempty"` // empty on success, contains error string on failure
}

RunMetadata holds metadata about a benchmark run

func LoadRunMetadata added in v0.1.1

func LoadRunMetadata(filePath string) (*RunMetadata, error)

type RunResult added in v0.3.0

type RunResult struct {
	RunID    string
	RunDir   string
	Metadata *RunMetadata
}

RunResult describes a completed workflow invocation.

func RunWorkflow

func RunWorkflow(ctx context.Context, cfg *config.Config, customMetadata map[string]string, envVars map[string]string) (*RunResult, error)

RunWorkflow executes a benchmark workflow with run ID tracking.

type StringComparisonResult added in v0.1.1

type StringComparisonResult struct {
	Key    string
	Value1 *string
	Value2 *string
}

func (*StringComparisonResult) Format added in v0.1.1

func (r *StringComparisonResult) Format() string

func (*StringComparisonResult) GetKey added in v0.1.1

func (r *StringComparisonResult) GetKey() string

func (*StringComparisonResult) GetValue1 added in v0.1.1

func (r *StringComparisonResult) GetValue1() string

func (*StringComparisonResult) GetValue2 added in v0.1.1

func (r *StringComparisonResult) GetValue2() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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