Documentation
¶
Index ¶
- Constants
- func AddMetadata(runPath string, extraMetadata map[string]string) error
- func CallWithRetry[T any](ctx context.Context, fn func() (T, error), maxAttempts int, ...) (T, error)
- func ConfigureDefaultLogger()
- func InspectRun(runPath string, verbose bool) string
- func PrintComparisonResults(results []ComparisonResult) string
- func SyncResults(ctx context.Context, cfg *config.Config) error
- type ComparisonResult
- type FloatComparisonResult
- type GitMetadata
- type RunMetadata
- type RunResult
- type StringComparisonResult
Constants ¶
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" )
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 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 PrintComparisonResults ¶ added in v0.1.1
func PrintComparisonResults(results []ComparisonResult) string
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
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.
type StringComparisonResult ¶ added in v0.1.1
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