bengine

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package bengine handles running benchmarks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractArchiveFromReader

func ExtractArchiveFromReader(ctx context.Context, dest string, fileName string, r io.Reader) error

ExtractArchiveFromReader extracts any type of archive (compressed/uncompressend) using magic number to the specified destination.

Types

type Config

type Config struct {
	Store            *store.RedisStore
	Sub              *pubgo.Subscription
	S3               s3.ObjectStore
	RegistryUsername string
	RegistryPassword string
	RootDest         string
	LoggingLevel     zerolog.Level
	HumanReadable    bool
	// contains filtered or unexported fields
}

Config struct for a bengine instance.

type Engine

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

Engine is a benchmark runner with docker containers.

func New

func New(sub *pubgo.Subscription, opts ...Opts) *Engine

New creates a new benchmark engine.

func (*Engine) ConsumeEvent

func (e *Engine) ConsumeEvent(ctx context.Context, cli *client.Client, event *types.BenchEvent) error

ConsumeEvent handles a benchmarking event.

func (*Engine) PullDataset

func (e *Engine) PullDataset(ctx context.Context, url string, outputPath string, fromS3 bool) error

PullDataset pulls a dataset from a public source with http.

func (*Engine) PullDatasetFromS3

func (e *Engine) PullDatasetFromS3(ctx context.Context, url string, outputPath string) error

PullDatasetFromS3 pulls a dataset from a S3 object.

func (*Engine) RecordRun

func (e *Engine) RecordRun(ctx context.Context, event *types.BenchEvent, result string) error

RecordRun records a run into the store.

func (*Engine) RunContainer

func (e *Engine) RunContainer(ctx context.Context, image, datasetName, datasetPath, checkpointPath string,
) (string, error)

RunContainer runs a benchmark on a container with a specified image, dataset, and checkpoint.

func (*Engine) Start

func (e *Engine) Start(ctx context.Context)

Start starts the engine instance.

type Opts

type Opts func(cfg *Config)

Opts handler function for setting engine configuration.

func WithHostSourceVolume

func WithHostSourceVolume(source string) Opts

WithHostSourceVolume sets host source volume if service is running inside a container.

func WithHumanReadableLogs

func WithHumanReadableLogs() Opts

WithHumanReadableLogs disables structured logging.

func WithLoggingLevel

func WithLoggingLevel(lvl zerolog.Level) Opts

WithLoggingLevel sets logging level.

func WithRedisStore

func WithRedisStore(store *store.RedisStore) Opts

WithRedisStore sets the redis store used to record benchmarking runs. If no redis store is provided, saving is skipped.

func WithRegistryCreds

func WithRegistryCreds(username, password string) Opts

WithRegistryCreds sets the credentials of the docker registry to pull images from.

func WithRootDest

func WithRootDest(dest string) Opts

WithRootDest sets root destination where datasets & checkpoints are saved.

func WithS3

func WithS3(store s3.ObjectStore) Opts

WithS3 enables pulling datasets from an S3 bucket.

Jump to

Keyboard shortcuts

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