workflows

package
v0.8.13 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentdExecutor

type AgentdExecutor interface {
	Execute(ctx context.Context, podIP string, req *NodeExecRequest) (*NodeExecResponse, error)
}

type HTTPAgentdExecutor

type HTTPAgentdExecutor struct {
	Port   int
	Client *http.Client
}

HTTPAgentdExecutor calls agentd via HTTP.

func (*HTTPAgentdExecutor) Execute

type NodeExecRequest

type NodeExecRequest struct {
	NodeID   string          `json:"nodeId"`
	NodeType string          `json:"nodeType"`
	Spec     json.RawMessage `json:"spec"`
	Input    json.RawMessage `json:"input"`
	Timeout  string          `json:"timeout,omitempty"`
}

type NodeExecResponse

type NodeExecResponse struct {
	Output    json.RawMessage `json:"output,omitempty"`
	Branch    string          `json:"branch,omitempty"`
	ErrorCode string          `json:"errorCode,omitempty"`
	Detail    string          `json:"detail,omitempty"`
}

type ReconcilerLogger

type ReconcilerLogger interface {
	Info(msg string, keysAndValues ...any)
	Error(err error, msg string, keysAndValues ...any)
}

type ReconcilerStore

type ReconcilerStore interface {
	ClaimQueuedRuns(ctx context.Context, limit int) ([]*wf.WorkflowRunRow, error)
	UpdateWorkflowRunStatus(ctx context.Context, runID, status string, errorCode *string, errMsg json.RawMessage, output json.RawMessage) error
	CreateNodeRun(ctx context.Context, row *wf.WorkflowNodeRunRow) error
	UpdateNodeRunStatus(ctx context.Context, nodeRunID, status string, output json.RawMessage, branch *string, errorCode *string, errMsg json.RawMessage) error
	IncrementTriggerFailures(ctx context.Context, triggerID string) (int, error)
	ResetTriggerFailures(ctx context.Context, triggerID string) error
}

type Scheduler

type Scheduler struct {
	Store        SchedulerStore
	Logger       ReconcilerLogger
	TickInterval time.Duration
	BatchLimit   int
}

Scheduler polls due cron triggers and fires them.

func (*Scheduler) NeedLeaderElection

func (s *Scheduler) NeedLeaderElection() bool

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context) error

type SchedulerStore

type SchedulerStore interface {
	ListDueCronTriggers(ctx context.Context, now time.Time, limit int) ([]*wf.TriggerRow, error)
	GetWorkflow(ctx context.Context, ownerType, ownerID, workflowID string) (*wf.WorkflowRow, error)
	CreateWorkflowRunWithFire(ctx context.Context, fire *wf.TriggerFireRow, run *wf.WorkflowRunRow) error
	CreateTriggerFire(ctx context.Context, row *wf.TriggerFireRow) error
	UpdateTriggerFireTimestamps(ctx context.Context, triggerID string, lastFiredAt time.Time, nextFireAt *time.Time) error
	IncrementTriggerFailures(ctx context.Context, triggerID string) (int, error)
	DisableTrigger(ctx context.Context, triggerID string) error
}

SchedulerStore is the narrow store interface for the scheduler.

type WorkflowReconciler

type WorkflowReconciler struct {
	Store         ReconcilerStore
	AgentdClient  AgentdExecutor
	K8sClient     WorkspaceActivator
	Logger        ReconcilerLogger
	MaxConcurrent int
	TickInterval  time.Duration
	// contains filtered or unexported fields
}

WorkflowReconciler drives workflow runs from queued to terminal.

func (*WorkflowReconciler) Cancel

func (r *WorkflowReconciler) Cancel(runID string)

func (*WorkflowReconciler) NeedLeaderElection

func (r *WorkflowReconciler) NeedLeaderElection() bool

func (*WorkflowReconciler) Start

func (r *WorkflowReconciler) Start(ctx context.Context) error

type WorkspaceActivator

type WorkspaceActivator interface {
	EnsureActive(ctx context.Context, workspaceID string, timeout time.Duration) (podIP string, err error)
}

Jump to

Keyboard shortcuts

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