Documentation
¶
Overview ¶
Package proc owns process liveness and control addressing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DAGSocketAddr ¶
DAGSocketAddr returns the control socket address for a 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 ¶
AttemptKey returns a stable identifier for the exact proc-backed attempt.
func (ProcEntry) RunScopeKey ¶
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.
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.