taskutil

package
v2.0.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveDeploymentErrorsByService

func ActiveDeploymentErrorsByService(tasks []swarm.Task) map[string]string

ActiveDeploymentErrorsByService returns serviceID -> error text for services that have at least one slot where an error task is newer than the most recent running task (or where there is no running task for that slot).

Only errors within the last 5 minutes (relative to the newest task in the entire set) are considered, to avoid surfacing stale historical failures. When multiple slots error for the same service, the most recent error wins.

func LatestTasksByServiceKey

func LatestTasksByServiceKey(tasks []swarm.Task) []swarm.Task

LatestTasksByServiceKey returns the most relevant task per slot. Tasks that want to be running are preferred over terminal tasks; within the same tier the most recent task wins.

func TaskKeyForService

func TaskKeyForService(t swarm.Task) string

TaskKeyForService returns a unique key for a task's slot within its service. For replicated services this is serviceID:slot, for global services serviceID:nodeID.

func TaskRowStyle

func TaskRowStyle(t docker.TaskEntry, base lipgloss.Style) lipgloss.Style

TaskRowStyle tints one task row by what the row is telling the operator, and returns base for a task with nothing to say. Red is kept for a task that went wrong — it failed, was rejected, orphaned, recorded an error, or its healthcheck is failing. A task swarm stopped on purpose gets yellow: that happens on every update, scale-down and node drain, and the container's docker-ps state is "exited" for it exactly as it is for a crash, so the swarm task state is what tells the two apart (issue #601).

base is the caller's normal row style rather than a colour of ours: the three views showing tasks each render an ordinary row in their own colour, and only the two exceptional tints are shared.

func TaskTimestamp

func TaskTimestamp(t swarm.Task) time.Time

TaskTimestamp returns the effective timestamp for a task, falling back to CreatedAt when Status.Timestamp is zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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