executor

package
v1.23.0-cx Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExecutorNotExists = errors.New("executor not exists")
)

Functions

func RemoveExecutor

func RemoveExecutor(resourceType, jobName string)

RemoveExecutor removes the executor from the nodeTaskExecutors, found by resource type and job name.

Types

type NodeTaskExecutor

type NodeTaskExecutor struct {

	// UpdateNodeTaskStatus defines a function to update the status of the node task.
	UpdateNodeTaskStatus UpdateNodeTaskStatus
	// contains filtered or unexported fields
}

func GetExecutor

func GetExecutor(resourceType, jobName string) (*NodeTaskExecutor, error)

GetExecutor returns the found executors from the nodeTaskExecutors, found by resource type and job name.

func NewNodeTaskExecutor

func NewNodeTaskExecutor(ctx context.Context, job wrap.NodeJob, updateFun UpdateNodeTaskStatus,
) (*NodeTaskExecutor, bool, error)

NewNodeTaskExecutor create an executor and add to nodeTaskExecutors. If one already exists in nodeTaskExecutors, use it.

func (*NodeTaskExecutor) Execute

func (executor *NodeTaskExecutor) Execute(ctx context.Context, connectedNodes []string)

Execute executes the node tasks. It uses a pool to control the number of concurrent executions of node tasks. The connectedNodes arg indicates the edge nodes that the current CloudCore is connected to. Only these nodes will execute tasks.

func (*NodeTaskExecutor) FinishTask

func (executor *NodeTaskExecutor) FinishTask()

FinishTask when a node task has been completed, this function needs to be executed. Whether the node task is completed is sensed in the upstream.

func (*NodeTaskExecutor) Interrupt

func (executor *NodeTaskExecutor) Interrupt()

Interrupt interrupts the executor

type Pool

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

func NewPool

func NewPool(size int) *Pool

func (*Pool) Acquire

func (p *Pool) Acquire()

func (*Pool) Release

func (p *Pool) Release()

type UpdateNodeTaskStatus

type UpdateNodeTaskStatus func(ctx context.Context, job wrap.NodeJob, task wrap.NodeJobTask)

Jump to

Keyboard shortcuts

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