runner

package
v0.2.50 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const AbortContextFieldKey = "abortContextMap"

AbortContextFieldKey is a context key used to share data, such as a task ID, between an ongoing task and a potential abort task.

View Source
const ExecutionMode = "EXECUTOR_EXECUTION_MODE"

ExecutionMode is an environment variable that determines the execution mode of the executor.

View Source
const ExecutionModeDaemon = "daemon"

ExecutionModeDaemon represents the execution mode for running the executor as a daemon.

Variables

This section is empty.

Functions

func Execute

func Execute(pluginVersion string, buildDate string, runner Runner)

Execute executes the runner with the provided plugin version, build date, and runner implementation.

func GetValueFromContext added in v0.2.37

func GetValueFromContext(ctx context.Context, contextValueKey string, valueKey string) (interface{}, error)

func PutValueToContextMap added in v0.2.37

func PutValueToContextMap(ctx context.Context, contextValueKey string, key string, value interface{}) error

func StartInputContextWatcher

func StartInputContextWatcher(onInputContextUpdateFunc ExecuteFunction, pluginVersion string, buildDate string, runner Runner)

StartInputContextWatcher starts the input context watcher that monitors changes in the input context secret. When a change is detected, the provided onInputContextUpdateFunc is invoked.

Types

type CommandFactoryBuilder added in v0.2.37

type CommandFactoryBuilder func(input task.InputContext) (command.CommandFactory, error)

CommandFactoryBuilder represents the function signature for building a command factory.

type CommandRunner

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

CommandRunner represents a command-based implementation of the Runner interface.

func NewCommandRunner

func NewCommandRunner(factoryBuilder CommandFactoryBuilder) *CommandRunner

NewCommandRunner creates a new instance of CommandRunner

func (CommandRunner) Run

func (runner CommandRunner) Run(ctx task.InputContext) *task.Result

Run executes the task using the command-based approach. The command is then executed asynchronously and waits for either an abort signal or for the execution to complete.

If an abort signal is received, it deserializes an abort command and executes it. The task result reflects the output of the abort command.

If the command finishes executing before an abort signal is received, the task result reflects the output of the executed command.

type ExecuteFunction

type ExecuteFunction func(pluginVersion string, buildDate string, runner Runner)

ExecuteFunction represents the function signature for executing the runner.

type RunFunction

type RunFunction func(task.InputContext) *task.Result

RunFunction represents the function signature for running a task.

type Runner

type Runner interface {
	Run(task.InputContext) *task.Result
}

Runner is an interface for executing a task.

type SimpleRunner

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

SimpleRunner represents a simple implementation of the Runner interface.

func NewSimpleRunner

func NewSimpleRunner(run RunFunction) *SimpleRunner

NewSimpleRunner creates a new instance of SimpleRunner.

func (SimpleRunner) Run

func (runner SimpleRunner) Run(ctx task.InputContext) *task.Result

Run executes the task using the provided RunFunction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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