task

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionInfo

type ExecutionInfo struct {
	TaskID         uuid.UUID
	Components     []WorkflowComponent
	RuleDefinition *operationrules.RuleDefinition
}

ExecutionInfo contains the information needed to execute a task. RuleDefinition contains the resolved operation rule (resolved at task creation time).

type ExecutionRequest

type ExecutionRequest struct {
	Info  ExecutionInfo
	Async bool
}

ExecutionRequest holds the parameters for submitting a task for execution.

func (*ExecutionRequest) Validate

func (r *ExecutionRequest) Validate() error

Validate returns an error if the ExecutionRequest is missing required fields.

type ExecutionResponse

type ExecutionResponse struct {
	ExecutionID string
}

ExecutionResponse holds the result of a task execution submission.

func (*ExecutionResponse) IsValid

func (r *ExecutionResponse) IsValid() bool

IsValid reports whether the ExecutionResponse contains a non-empty execution ID.

type Task

type Task struct {
	ID            uuid.UUID
	Operation     operation.Wrapper
	RackID        uuid.UUID // The rack this task operates on (1 task = 1 rack)
	Attributes    taskcommon.TaskAttributes
	Description   string
	ExecutorType  taskcommon.ExecutorType
	ExecutionID   string
	Status        taskcommon.TaskStatus
	Message       string
	AppliedRuleID *uuid.UUID // The ID of the operation rule that was applied
	CreatedAt     time.Time
	UpdatedAt     time.Time
	StartedAt     *time.Time
	FinishedAt    *time.Time

	// QueueExpiresAt is the deadline for a waiting task to be promoted.
	// After this time the Promoter terminates the task automatically.
	// Nil for non-waiting tasks.
	QueueExpiresAt *time.Time
}

Task defines the details of a task. It includes: -- ID: The unique identifier of the task. -- Operation: The operation to be performed by the task. -- RackID: The rack this task operates on (1 task = 1 rack). -- Attributes: Flexible metadata including targeted components by type. -- Description: The description of the task provided by the user. -- ExecutorType: The type of executor to be used for the task. -- ExecutionID: The identifier of the execution of the task. -- Status: The status of the task. -- Message: Status message or error details. -- AppliedRuleID: The ID of the operation rule that was applied (if any).

type TaskStatusUpdate

type TaskStatusUpdate struct {
	ID      uuid.UUID
	Status  taskcommon.TaskStatus
	Message string
}

TaskStatusUpdate carries the fields needed to update a task's status.

type TaskStatusUpdater

type TaskStatusUpdater interface {
	// UpdateTaskStatus persists the status change described by arg.
	UpdateTaskStatus(ctx context.Context, arg *TaskStatusUpdate) error
}

TaskStatusUpdater is implemented by any store that can persist task status changes.

type WorkflowComponent

type WorkflowComponent struct {
	Type        devicetypes.ComponentType `json:"type"`
	ComponentID string                    `json:"component_id"`
}

WorkflowComponent holds the minimal component data needed to execute a workflow. All fields are plain JSON-safe types.

Jump to

Keyboard shortcuts

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