proc

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package proc owns process liveness and control addressing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DAGSocketAddr

func DAGSocketAddr(dag *ir.DAG, runID string) string

DAGSocketAddr returns the control socket address for a DAG run.

func SubDAGSocketAddr

func SubDAGSocketAddr(dag *ir.DAG, runID string) string

SubDAGSocketAddr returns the control socket address for a child DAG run.

Types

type ProcEntry

type ProcEntry struct {
	GroupName       string
	Identity        ProcEntryID
	Meta            ProcMeta
	LastHeartbeatAt int64
	Fresh           bool
}

ProcEntry represents a storage-independent proc heartbeat observation.

func (ProcEntry) AttemptKey

func (e ProcEntry) AttemptKey() string

AttemptKey returns a stable identifier for the exact proc-backed attempt.

func (ProcEntry) DAGRun

func (e ProcEntry) DAGRun() ir.DAGRunRef

DAGRun returns the DAG-run reference for the proc entry.

func (ProcEntry) IsRoot

func (e ProcEntry) IsRoot() bool

IsRoot reports whether the proc entry belongs to a root DAG run.

func (ProcEntry) RunScopeKey

func (e ProcEntry) RunScopeKey() string

RunScopeKey returns a stable identifier for the DAG-run scope across attempts.

type ProcEntryID

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

ProcEntryID is an opaque identity returned by ProcStore for exact stale-entry removal. Callers must not interpret it as a filesystem path or record key.

func NewProcEntryID

func NewProcEntryID(token string) ProcEntryID

NewProcEntryID creates an opaque proc entry identity token.

func (ProcEntryID) IsZero

func (id ProcEntryID) IsZero() bool

IsZero reports whether the identity is empty.

func (ProcEntryID) String

func (id ProcEntryID) String() string

String returns an opaque display token. Callers must not parse it.

type ProcHandle

type ProcHandle interface {
	// Stop stops the heartbeat for the process.
	Stop(ctx context.Context) error
}

ProcHandle represents a process that is associated with a dag-run.

type ProcHeartbeat

type ProcHeartbeat struct {
	GroupName       string
	DAGRun          ir.DAGRunRef
	AttemptID       string
	StartedAt       int64
	LastHeartbeatAt int64
	ObservedAt      time.Time
	Fresh           bool
}

ProcHeartbeat is a storage-independent observation of a proc heartbeat.

func (ProcHeartbeat) AdvancedSince

func (h ProcHeartbeat) AdvancedSince(previous ProcHeartbeat) bool

AdvancedSince reports whether this observation is newer than previous.

type ProcMeta

type ProcMeta struct {
	StartedAt    int64
	Name         string
	DAGRunID     string
	AttemptID    string
	RootName     string
	RootDAGRunID string
}

ProcMeta is a struct that holds metadata for a process.

func (ProcMeta) DAGRun

func (m ProcMeta) DAGRun() ir.DAGRunRef

DAGRun returns the DAG-run reference for the proc entry.

func (ProcMeta) Root

func (m ProcMeta) Root() ir.DAGRunRef

Root returns the root DAG-run reference if present.

type ProcStore

type ProcStore interface {
	// Lock try to lock process group return error if it's held by another process
	Lock(ctx context.Context, groupName string) error
	// UnLock unlocks process group
	Unlock(ctx context.Context, groupName string)
	// Acquire creates a new process entry for a given group name and execution metadata.
	// It automatically starts the heartbeat for the process.
	Acquire(ctx context.Context, groupName string, meta ProcMeta) (ProcHandle, error)
	// CountAlive retrieves the number of processes associated with a group name.
	CountAlive(ctx context.Context, groupName string) (int, error)
	// CountAlive retrieves the number of processes associated with a group name.
	CountAliveByDAGName(ctx context.Context, groupName, dagName string) (int, error)
	// IsRunAlive checks if a specific DAG run is currently alive.
	IsRunAlive(ctx context.Context, groupName string, dagRun ir.DAGRunRef) (bool, error)
	// IsAttemptAlive checks if a specific DAG-run attempt is currently alive.
	IsAttemptAlive(ctx context.Context, groupName string, dagRun ir.DAGRunRef, attemptID string) (bool, error)
	// ListAlive returns list of running DAG runs by the group name.
	ListAlive(ctx context.Context, groupName string) ([]ir.DAGRunRef, error)
	// ListAllAlive returns all running DAG runs across all groups.
	// Returns a map where key is the group name and value is list of DAG runs.
	ListAllAlive(ctx context.Context) (map[string][]ir.DAGRunRef, error)
	// ListEntries returns all proc entries for a group, including stale entries.
	ListEntries(ctx context.Context, groupName string) ([]ProcEntry, error)
	// LatestFreshEntryByDAGName returns the freshest proc entry for the DAG in the group.
	LatestFreshEntryByDAGName(ctx context.Context, groupName, dagName string) (*ProcEntry, error)
	// LatestHeartbeat returns the latest heartbeat observation for a DAG-run in the group.
	LatestHeartbeat(ctx context.Context, groupName string, dagRun ir.DAGRunRef) (*ProcHeartbeat, error)
	// ListAllEntries returns all proc entries across all groups, including stale entries.
	ListAllEntries(ctx context.Context) ([]ProcEntry, error)
	// RemoveIfStale removes the exact proc entry if it is still stale and unchanged.
	RemoveIfStale(ctx context.Context, entry ProcEntry) error
}

ProcStore is an interface for managing process storage.

Jump to

Keyboard shortcuts

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