execution

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package execution holds what the workflows and the tasks they run share: the context handed from one task to the next, and the lookups every task starts from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindBatchProcess

func FindBatchProcess(ctx context.Context, processes *processrepo.ProcessRepository, processID string) (*model.Process, error)

FindBatchProcess returns a process that carries a batch section, which is the only kind a batch task can act on.

Types

type Context

type Context struct {
	GlobalJobConfigs *GlobalJobConfigs      `json:"globalJobConfigs,omitempty"`
	Data             map[string]interface{} `json:"data,omitempty"`
	SomeData         string                 `json:"someData,omitempty"`
}

Context is handed from one task of a workflow to the next. It crosses the workflow backend between tasks, so everything in it must survive a round trip through JSON.

type GlobalJobConfigs

type GlobalJobConfigs struct {
	MailUser string
}

func LoadGlobalJobConfigs

func LoadGlobalJobConfigs() (*GlobalJobConfigs, error)

LoadGlobalJobConfigs reads the settings every job of the platform is submitted with.

type TaskTracker

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

TaskTracker records the status history of the tasks an activity carries out.

func NewTaskTracker

func NewTaskTracker(statuses *processrepo.TaskStatusRepository) *TaskTracker

NewTaskTracker returns a tracker writing to statuses.

func (*TaskTracker) Record

func (t *TaskTracker) Record(ctx context.Context, processID, taskID string, taskType model.TaskType,
	status model.TaskStatusType, log *string)

Record appends one status to a task's history, logging rather than returning a failure to write it.

func (*TaskTracker) Track

func (t *TaskTracker) Track(ctx context.Context, processID, taskID string, taskType model.TaskType,
	in *Context, run func() (*Context, error)) (*Context, error)

Track runs one attempt of a task between an EXECUTING status and the status its outcome earns: COMPLETED on success, FAILED with the error as the log otherwise.

It is called from inside an activity, never from the workflow, since a workflow body is replayed and must not write. Each retry of the activity is an attempt of its own, so a task retried twice shows two FAILED entries before its last outcome.

A task that has already completed is not run again: Track hands in back unchanged and records nothing. That is what lets a retried process re-run a failed workflow without repeating the steps that got through — staging a file twice, or submitting the job again. A completed status is enough to go by, rather than the latest one, because two statuses of one attempt can share a timestamp.

A status that cannot be written is logged and dropped rather than failing the task: the history describes the work, and losing an entry of it is no reason to redo work that succeeded.

Jump to

Keyboard shortcuts

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