engine

package
v0.0.0-...-9d58fce Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Ping checks the engine is working.
	Ping(ctx context.Context) error
	// CreateRunner creates a runner by RunnerSpec.
	CreateRunner(ctx context.Context, logProvider LogProvider, option *api.Job) (Runner, error)
}

type LogProvider

type LogProvider interface {
	// CreateLogWriter creates a log writer for a log name.
	// The log name should be start with `_` to avoid conflict with job logs.
	CreateLogWriter(ctx context.Context, logName string) io.WriteCloser
	GetDefaultLogWriter(ctx context.Context) io.WriteCloser
}

LogProvider provides a log writer for a log name. Engines and Runners can use the log writer to write logs of engine or runner itself, it make it easy to debug.

type MultipleContainerRunner

type MultipleContainerRunner interface {
	Runner
	// GetContainerExecutor gets an executor from the runner.
	// The Executor is a client to operate in the runner such run commands, read files.
	// The containerName is the name of the container to run the executor.
	// For non-container runner, the containerName can be ignored.
	GetContainerExecutor(ctx context.Context, containerName string) (executorpb.ExecutorClient, error)
}

MultipleContainerRunner is a runner that has multiple containers.

type Runner

type Runner interface {
	// Start starts the runner.
	// Before Start, the runner is not ready to run job. In most case, no resources is allocated.
	Start(ctx context.Context) error
	// GetExecutor gets an executor from the runner.
	// The Executor is a client to operate in the runner such run commands, read files.
	GetExecutor(ctx context.Context) (executorpb.ExecutorClient, error)
	// Stop stops the runner. All resources should be released.
	Stop(ctx context.Context) error
}

Runner is an environment to run job (compile job, ci job, etc). In most Engine, a runner presents a clean environment, such as a container, a VM, etc.

Directories

Path Synopsis
vm

Jump to

Keyboard shortcuts

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