executor

package
v1.30.3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTask

func CreateTask(
	dagName string,
	yamlDefinition string,
	op coordinatorv1.Operation,
	runID string,
	opts ...TaskOption,
) *coordinatorv1.Task

CreateTask creates a coordinator task from this DAG for distributed execution. It constructs a task with the given operation and run ID, setting the DAG's name as both the root DAG and target, and includes the DAG's YAML definition.

func RegisterExecutor

func RegisterExecutor(executorType string, factory ExecutorFactory, validator core.StepValidator, caps core.ExecutorCapabilities)

RegisterExecutor registers a new executor type with its factory, validator, and capabilities.

Types

type ChatMessageHandler added in v1.30.0

type ChatMessageHandler interface {
	SetContext([]execution.LLMMessage)
	GetMessages() []execution.LLMMessage
}

ChatMessageHandler is an interface for executors that handle chat conversation messages.

type DAGExecutor

type DAGExecutor interface {
	Executor

	// SetParams sets the parameters for running a sub DAG.
	SetParams(RunParams)
}

DAGExecutor is an interface for sub DAG executors.

type Executor

type Executor interface {
	SetStdout(out io.Writer)
	SetStderr(out io.Writer)
	Kill(sig os.Signal) error
	Run(ctx context.Context) error
}

Executor is an interface for executing steps in a DAG.

func NewExecutor

func NewExecutor(ctx context.Context, step core.Step) (Executor, error)

NewExecutor creates a new Executor based on the step's executor type.

type ExecutorFactory

type ExecutorFactory func(ctx context.Context, step core.Step) (Executor, error)

ExecutorFactory is a function type that creates an Executor based on the step configuration.

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

ExitCoder is an interface for executors that can return an exit code.

type NodeStatusDeterminer

type NodeStatusDeterminer interface {
	DetermineNodeStatus() (core.NodeStatus, error)
}

NodeStatusDeterminer is an interface for reporting the status of a node execution.

type ParallelExecutor

type ParallelExecutor interface {
	Executor

	// SetParamsList sets the parameters for running multiple sub DAGs in parallel.
	SetParamsList([]RunParams)
}

ParallelExecutor is an interface for parallel step executors.

type RunParams

type RunParams struct {
	RunID  string
	Params string
}

RunParams holds the parameters for running a sub DAG.

type SubDAGExecutor added in v1.24.0

type SubDAGExecutor struct {
	// DAG is the sub DAG to execute.
	// For local DAGs, this DAG's Location will be set to a temporary file.
	DAG *core.DAG
	// contains filtered or unexported fields
}

SubDAGExecutor is a helper for executing sub DAGs. It handles both regular DAGs and local DAGs (defined in the same file).

func NewSubDAGExecutor added in v1.24.0

func NewSubDAGExecutor(ctx context.Context, childName string) (*SubDAGExecutor, error)

NewSubDAGExecutor creates a new SubDAGExecutor. It handles the logic for finding the DAG - either from the database or from local DAGs defined in the parent.

func (*SubDAGExecutor) BuildCoordinatorTask added in v1.24.0

func (e *SubDAGExecutor) BuildCoordinatorTask(ctx context.Context, runParams RunParams) (*coordinatorv1.Task, error)

BuildCoordinatorTask creates a coordinator task for distributed execution

func (*SubDAGExecutor) Cleanup added in v1.24.0

func (e *SubDAGExecutor) Cleanup(ctx context.Context) error

Cleanup removes any temporary files created for local DAGs. This should be called after the sub DAG execution is complete.

func (*SubDAGExecutor) Execute added in v1.24.11

func (e *SubDAGExecutor) Execute(ctx context.Context, runParams RunParams, workDir string) (*execution.RunStatus, error)

Execute executes the sub DAG and returns the result. This is useful for parallel execution where results need to be collected.

func (*SubDAGExecutor) Kill added in v1.24.0

func (e *SubDAGExecutor) Kill(sig os.Signal) error

Kill terminates all running sub DAG processes (both local and distributed)

type TailWriter

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

TailWriter forwards to an underlying writer and keeps a rolling tail of recent output up to `max` bytes. Safe for concurrent use.

func NewTailWriter

func NewTailWriter(out io.Writer, max int) *TailWriter

NewTailWriter creates a tailWriter that keeps a rolling buffer of recent output with a maximum size of `max` bytes. If max <= 0, it falls back to defaultStderrTailLimit. If out is nil, it defaults to os.Stderr to preserve exec's behavior.

func NewTailWriterWithEncoding added in v1.26.0

func NewTailWriterWithEncoding(out io.Writer, max int, encoding string) *TailWriter

NewTailWriterWithEncoding creates a TailWriter with character encoding support. The encoding parameter specifies the character encoding of the output (e.g., "utf-8", "shift_jis", "euc-jp"). If empty, UTF-8 is assumed.

func (*TailWriter) Tail

func (t *TailWriter) Tail() string

Tail returns the rolling tail buffer (up to max bytes) as a decoded string. If an encoding was specified during creation, the buffer is decoded from that encoding to UTF-8. Otherwise, the raw bytes are returned as a string.

func (*TailWriter) Write

func (t *TailWriter) Write(p []byte) (int, error)

type TaskOption

type TaskOption func(*coordinatorv1.Task)

TaskOption is a function that modifies a coordinatorv1.Task.

func WithParentDagRun

func WithParentDagRun(ref execution.DAGRunRef) TaskOption

WithParentDagRun sets the parent DAG run name and ID in the task.

func WithRootDagRun

func WithRootDagRun(ref execution.DAGRunRef) TaskOption

WithRootDagRun sets the root DAG run name and ID in the task.

func WithStep

func WithStep(step string) TaskOption

WithStep sets the step name for retry operations.

func WithTaskParams

func WithTaskParams(params string) TaskOption

WithTaskParams sets the parameters for the task.

func WithWorkerSelector

func WithWorkerSelector(selector map[string]string) TaskOption

WithWorkerSelector sets the worker selector labels for the task.

Jump to

Keyboard shortcuts

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