execute

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

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

Go to latest
Published: Dec 24, 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, step proto.Step, resource *proto.StepResource)

SetFrameworkInfo sets the framework info for the StepExecutor.

Types

type StepExecFrameworkInfo

type StepExecFrameworkInfo interface {

	// GetStep returns the step.
	GetStep() proto.Step
	// 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.
	// task executor will retry if the returned error is retryable, see
	// IsRetryableError in TaskExecutor.Extension, else framework will mark random
	// subtask as failed, to trigger task failure.
	Init(context.Context) error
	// RunSubtask is used to run the subtask.
	// The subtask meta can be updated in place, if no error returned, the subtask
	// meta will be updated in the task table.
	RunSubtask(ctx context.Context, subtask *proto.Subtask) error

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

	// Cleanup is used to clean up the environment for this step.
	// the returned error will not affect task/subtask state, it's only logged,
	// so don't put code that's prone to error in it.
	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