execute

package
v1.1.0-beta.0...-a97aa45 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFrameworkInfo

func SetFrameworkInfo(exec StepExecutor, resource *proto.StepResource)

SetFrameworkInfo sets the framework info for the StepExecutor.

Types

type StepExecFrameworkInfo

type StepExecFrameworkInfo interface {

	// GetResource returns the expected resource of this step executor.
	GetResource() *proto.StepResource
	// contains filtered or unexported methods
}

StepExecFrameworkInfo is an interface that should be embedded into the implementation of StepExecutor. It's set by the framework automatically and the implementation can use it to access necessary information. The framework will init it before `StepExecutor.Init`, before that you cannot call methods in this interface.

type StepExecutor

type StepExecutor interface {
	StepExecFrameworkInfo

	// Init is used to initialize the environment.
	// if failed, task executor will retry later.
	Init(context.Context) error
	// RunSubtask is used to run the subtask.
	RunSubtask(ctx context.Context, subtask *proto.Subtask) error

	// RealtimeSummary returns the realtime summary of the running subtask by this executor.
	RealtimeSummary() *SubtaskSummary

	// OnFinished is used to handle the subtask when it is finished.
	// The subtask meta can be updated in place.
	OnFinished(ctx context.Context, subtask *proto.Subtask) error
	// Cleanup is used to clean up the environment.
	Cleanup(context.Context) error
}

StepExecutor defines the executor for subtasks of a task step. the calling sequence is:

Init
for every subtask of this step:
	if RunSubtask failed then break
	else OnFinished
Cleanup

type SubtaskSummary

type SubtaskSummary struct {
	RowCount int64
}

SubtaskSummary contains the summary of a subtask.

Jump to

Keyboard shortcuts

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