entity

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 7 Imported by: ? 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

Index

Constants

View Source
const PlanKindCommand = "command"

PlanKindCommand takes a jobs.Command as Params; its runs report PlanRunStarted/PlanRunFinished.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plan added in v0.4.0

type Plan struct {
	ID          string     `json:"id"`
	Metadata    labels.Set `json:"metadata"`
	Description string     `json:"description"`
	Kind        string     `json:"kind"` // the plan manager builds Task.Job from it
	Params      any        `json:"params,omitempty"`
	Task        *Task      `json:"task"`
}

type PlanRun added in v0.7.0

type PlanRun struct {
	ID         string        `json:"id"`
	PlanID     string        `json:"plan_id"`
	Source     PlanRunSource `json:"source"`
	State      PlanRunState  `json:"state"`
	StartedAt  time.Time     `json:"started_at"`
	EndedAt    time.Time     `json:"ended_at,omitzero"`
	ExitCode   int           `json:"exit_code"` // for a kind with an exit status, like a command
	OutputTail string        `json:"output_tail,omitempty"`
	LogPath    string        `json:"log_path,omitempty"`
	Error      string        `json:"error,omitempty"`
}

PlanRun: each retry or requeue is a new run; a Trigger dropped before it starts ends canceled, StartedAt at the Trigger and no log.

type PlanRunFinished added in v0.7.0

type PlanRunFinished struct {
	PlanRun
}

func (PlanRunFinished) Kind added in v0.7.0

func (PlanRunFinished) Kind() string

type PlanRunSource added in v0.7.0

type PlanRunSource string

PlanRunSource is open: a Trigger caller may define its own values.

const (
	PlanRunSchedule PlanRunSource = "schedule"
	PlanRunManual   PlanRunSource = "manual"
)

type PlanRunStarted added in v0.7.0

type PlanRunStarted struct {
	PlanRun
}

func (PlanRunStarted) Kind added in v0.7.0

func (PlanRunStarted) Kind() string

type PlanRunState added in v0.7.0

type PlanRunState string
const (
	PlanRunRunning   PlanRunState = "running"
	PlanRunSucceeded PlanRunState = "succeeded"
	PlanRunFailed    PlanRunState = "failed"
	PlanRunCanceled  PlanRunState = "canceled"
)

type PlanStats added in v0.8.1

type PlanStats struct {
	ID            string        `json:"id"`
	Schedule      string        `json:"schedule"`
	State         string        `json:"state"`
	Progress      float64       `json:"progress"`
	StartedAt     time.Time     `json:"started_at"`
	ExecutionTime time.Duration `json:"execution_time"`
	Cooldown      time.Duration `json:"cooldown"`
	Retries       uint          `json:"retries"`
	Labels        labels.Set    `json:"labels"`
	Error         string        `json:"error"`
	LastRun       *PlanRun      `json:"last_run,omitempty"` // nil if never run
}

type PlanStatsOptions added in v0.8.1

type PlanStatsOptions struct {
	Selector string `json:"selector,omitempty"` // over Metadata; empty selects all
	All      bool   `json:"all"`                // include plans whose job succeeded
}

type PubsubMessage

type PubsubMessage struct {
	From    string `json:"from"`
	Topic   string `json:"topic"`
	Kind    string `json:"kind"`
	Payload any    `json:"payload"`
}

type SupervisorInitPolicy added in v0.6.9

type SupervisorInitPolicy struct {
	MaxRetries int
	Delay      time.Duration
	MaxDelay   time.Duration
}

SupervisorInitPolicy: MaxRetries 0 is one pass, -1 retries until ctx ends; Delay doubles up to MaxDelay.

type SupervisorMonitorPolicy added in v0.6.9

type SupervisorMonitorPolicy struct {
	Interval     time.Duration
	MaxRetries   int
	RestartDelay time.Duration
}

SupervisorMonitorPolicy: Interval 0 disables monitoring; MaxRetries bounds restarts per service (0 escalates a liveness failure at once, -1 unlimited).

type SupervisorStats added in v0.4.0

type SupervisorStats struct {
	Name              string
	Initialized       bool
	InitializedAt     time.Time
	InitializationErr error
	Started           bool
	StartedAt         time.Time
	StartErr          error
	Stopped           bool
	StoppedAt         time.Time
	StopErr           error
	HealthcheckedAt   time.Time
	HealthcheckErr    error
	LivenessErr       error
	Ready             bool
	ReadinessErr      error
	Restarts          int
	RestartedAt       time.Time
	InitDuration      time.Duration
	StartDuration     time.Duration
	StopDuration      time.Duration
	Source            common.Service
}

func (*SupervisorStats) Healthcheck added in v0.4.0

func (s *SupervisorStats) Healthcheck() error

func (*SupervisorStats) Uptime added in v0.4.0

func (s *SupervisorStats) Uptime() time.Duration

type SupervisorStopPolicy added in v0.6.9

type SupervisorStopPolicy struct {
	Timeout time.Duration
}

SupervisorStopPolicy: Timeout bounds each full stop and each restart's stop, then forces the rest; 0 defers to the caller's ctx.

type Task added in v0.8.1

type Task struct {
	Job      job.Job         `json:"-"`
	Ctx      context.Context `json:"-"`
	Params   any             `json:"params"`
	Schedule string          `json:"schedule"`
	// Manual tasks run only via Trigger.
	Manual   bool `json:"manual,omitempty"`
	Priority int  `json:"priority"` // lower runs first, then FIFO
	// Exclusive takes every slot; leftovers of a forced stop hold none.
	Exclusive     bool          `json:"exclusive"`
	Timeout       time.Duration `json:"timeout,omitempty"`
	RetryAttempts int           `json:"retry_attempts,omitempty"`
	RetryDelay    time.Duration `json:"retry_delay,omitempty"`
	// a requeue frees its slot while waiting; a task runs up to
	// (RetryAttempts+1) * (RequeueAttempts+1) times
	RequeueAttempts int           `json:"requeue_attempts,omitempty"`
	RequeueCooldown time.Duration `json:"requeue_cooldown,omitempty"`
}

Task is configuration only and copies like any value.

func (*Task) ID added in v0.8.1

func (t *Task) ID() string

ID is the job's ID; look tasks up by ID only.

func (*Task) IsOneShot added in v0.8.1

func (t *Task) IsOneShot() bool

IsOneShot tasks leave the task manager after they run.

func (*Task) IsValid added in v0.8.1

func (t *Task) IsValid() bool

func (*Task) String added in v0.8.1

func (t *Task) String() string

type TaskStats added in v0.8.1

type TaskStats struct {
	executor.Stats
	Requeues uint          `json:"requeues"` // of the current firing
	Cooldown time.Duration `json:"cooldown"` // remaining RequeueCooldown
	// while Requeueing the job stays failed: that run did fail
	Requeueing bool `json:"requeueing"`
}

Jump to

Keyboard shortcuts

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