executor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Counters = []prometheus.CounterDefinition{
	{
		Name: functionExecutionsMetric,
		Help: "Number of functions executed by the node.",
	},
	{
		Name: functionOkMetric,
		Help: "Number of functions successfully executed by the node.",
	},
	{
		Name: functionErrMetric,
		Help: "Number of functions executed by the node that resulted in an error.",
	},
	{
		Name: functionCPUUserTimeMetric,
		Help: "Total CPU user time this node spent executing functions in milliseconds.",
	},
	{
		Name: functionCPUSysTimeMetric,
		Help: "Total CPU sys time this node spent executing functions in milliseconds.",
	},
}
View Source
var Summaries = []prometheus.SummaryDefinition{
	{
		Name: functionDurationMetric,
		Help: "Total time this node spent executing functions - wall clock time in milliseconds.",
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	WorkDir         string           // directory where files needed for the execution are stored
	RuntimeDir      string           // directory where the executable can be found
	ExecutableName  string           // name for the executable
	DriversRootPath string           // where are cgi drivers stored
	FS              afero.Fs         // FS accessor
	Limiter         Limiter          // Resource limiter for executed processes
	Metrics         *metrics.Metrics // Metrics handle
}

Config represents the Executor configuration.

type Executor

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

Executor provides the capabilities to run external applications.

func New

func New(log zerolog.Logger, options ...Option) (*Executor, error)

New creates a new Executor with the specified working directory.

func (*Executor) ExecuteFunction

func (e *Executor) ExecuteFunction(ctx context.Context, requestID string, req execute.Request) (result execute.Result, retErr error)

ExecuteFunction will run the Blockless function defined by the execution request.

type Limiter

type Limiter interface {
	LimitProcess(proc execute.ProcessID) error
	ListProcesses() ([]int, error)
}

type Option

type Option func(*Config)

func WithExecutableName

func WithExecutableName(name string) Option

WithExecutableName sets the name of the executable that should be ran.

func WithFS

func WithFS(fs afero.Fs) Option

WithFS sets the FS handler used by the executor.

func WithLimiter

func WithLimiter(limiter Limiter) Option

WithLimiter sets the resource limiter called for each individual execution.

func WithMetrics added in v0.7.0

func WithMetrics(metrics *metrics.Metrics) Option

WithMetrics sets the metrics handler.

func WithRuntimeDir

func WithRuntimeDir(dir string) Option

WithRuntimeDir sets the runtime directory for the executor.

func WithWorkDir

func WithWorkDir(dir string) Option

WithWorkDir sets the workspace directory for the executor.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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