Documentation
¶
Index ¶
- Variables
- func AbortQueuedDAGRun(ctx context.Context, dagRunRepository *persis.DAGRunRepository, ...) error
- func EnqueueRetry(ctx context.Context, dagRunRepository *persis.DAGRunRepository, ...) (bool, error)
- func IsQueuedCatchup(status *ir.DAGRunStatus) bool
- func PreservedQueueTriggerType(status *ir.DAGRunStatus) ir.TriggerType
- type DAGRunNotQueuedError
- type EnqueueRetryOptions
- type QueuePriority
- type QueueStore
- type QueueWatcher
- type QueuedItemData
- type RetryAdmission
- type RunProcesses
- type StaleQueueDispatchError
Constants ¶
This section is empty.
Variables ¶
var (
ErrQueueItemNotFound = errors.New("queue item not found")
)
Errors for the queue
var ErrRetryStaleLatest = errors.New("retry target is no longer the latest attempt")
ErrRetryStaleLatest indicates the caller tried to retry a non-latest attempt.
Functions ¶
func AbortQueuedDAGRun ¶
func AbortQueuedDAGRun(ctx context.Context, dagRunRepository *persis.DAGRunRepository, dagRun ir.DAGRunRef) error
AbortQueuedDAGRun marks the latest visible queued attempt as aborted, hides it, and removes the dag-run record only when no visible attempts remain.
func EnqueueRetry ¶
func EnqueueRetry( ctx context.Context, dagRunRepository *persis.DAGRunRepository, queueStore QueueStore, dag *ir.DAG, status *ir.DAGRunStatus, opts EnqueueRetryOptions, ) (bool, error)
EnqueueRetry queues a DAG run for retry and records its Queued status. It restores the previous status if enqueueing fails and reports whether this call added the queue item.
func IsQueuedCatchup ¶
func IsQueuedCatchup(status *ir.DAGRunStatus) bool
IsQueuedCatchup reports whether the queued status belongs to a catchup run.
func PreservedQueueTriggerType ¶
func PreservedQueueTriggerType(status *ir.DAGRunStatus) ir.TriggerType
PreservedQueueTriggerType returns the trigger type that must be preserved when consuming a queued item. Queued retry records still execute as retries; initial queued runs keep the trigger that originally enqueued them.
Types ¶
type DAGRunNotQueuedError ¶
DAGRunNotQueuedError reports that the latest visible attempt is no longer queued.
func (*DAGRunNotQueuedError) Error ¶
func (e *DAGRunNotQueuedError) Error() string
type EnqueueRetryOptions ¶
type EnqueueRetryOptions struct {
// AutoRetry marks scheduler-issued DAG auto-retries. These consume the
// DAG-level retry budget at enqueue time.
AutoRetry bool
// TriggerActor replaces the attributable actor for a user-issued retry.
// Nil preserves the actor already recorded on the run.
TriggerActor *string
// Processes verifies that the execution which produced the status released
// the run. User retries wait briefly; automatic retries defer immediately.
// Nil skips the check.
Processes RunProcesses
}
EnqueueRetryOptions configure a retry enqueue.
type QueuePriority ¶
type QueuePriority int
QueuePriority represents the priority of a queued item
const ( QueuePriorityHigh QueuePriority = iota QueuePriorityLow )
type QueueStore ¶
type QueueStore interface {
// Enqueue adds an item to the queue
Enqueue(ctx context.Context, name string, priority QueuePriority, dagRun ir.DAGRunRef) error
// DequeueByDAGRunID retrieves items from the queue by dag-run reference and removes them
DequeueByDAGRunID(ctx context.Context, name string, dagRun ir.DAGRunRef) ([]QueuedItemData, error)
// DeleteByItemIDs removes the exact queued items identified by their queue item IDs.
DeleteByItemIDs(ctx context.Context, name string, itemIDs []string) (int, error)
// Len returns the number of items in the queue
Len(ctx context.Context, name string) (int, error)
// List returns all items in the queue with the given name
List(ctx context.Context, name string) ([]QueuedItemData, error)
// GetByItemID returns an exact item from the named queue.
GetByItemID(ctx context.Context, name, itemID string) (QueuedItemData, error)
// ListCursor returns one forward-only page of queued items for a specific queue.
ListCursor(ctx context.Context, name, cursor string, limit int) (pagination.CursorResult[QueuedItemData], error)
// Revision returns a value that changes when the ordered queue membership changes.
Revision(ctx context.Context, name string) (int64, error)
// All returns all items in the queue
All(ctx context.Context) ([]QueuedItemData, error)
// ListByDAGName returns all items that has a specific DAG name
ListByDAGName(ctx context.Context, name, dagName string) ([]QueuedItemData, error)
// QueueList lists all queue names that have at least one item in the queue
QueueList(ctx context.Context) ([]string, error)
// Watcher returns a QueueWatcher for the queue data
QueueWatcher(ctx context.Context) QueueWatcher
}
QueueStore provides an interface for interacting with the underlying database for storing and retrieving queued dag-run items.
type QueueWatcher ¶
type QueueWatcher interface {
// Start start swatching queue data and signal when a queue state changed
Start(ctx context.Context) (<-chan struct{}, error)
// Stop stops watching queue data
Stop(ctx context.Context)
}
QueueWatcher watches the queue state
type QueuedItemData ¶
type QueuedItemData interface {
// ID returns the ID of the queued item
ID() string
// Data returns the data of the queued item
Data() (*ir.DAGRunRef, error)
}
QueuedItemData represents a dag-run reference that is queued for execution.
type RetryAdmission ¶ added in v2.18.0
type RetryAdmission struct {
// Status is the accepted checkpoint for the retry. Callers must not mutate it.
Status *ir.DAGRunStatus
// contains filtered or unexported fields
}
RetryAdmission is an accepted retry of a specific run checkpoint.
func PrepareRetry ¶ added in v2.18.0
func PrepareRetry( ctx context.Context, dagRunRepository *persis.DAGRunRepository, dag *ir.DAG, status *ir.DAGRunStatus, opts EnqueueRetryOptions, ) (*RetryAdmission, error)
PrepareRetry accepts a retry only while the caller's attempt and status still match. It returns nil for an already accepted retry or a deferred auto-retry. The caller must queue or dispatch the admission, or roll it back on failure.
type RunProcesses ¶ added in v2.17.0
type RunProcesses interface {
IsAttemptAlive(ctx context.Context, procGroup string, dagRun ir.DAGRunRef, attemptID string) (bool, error)
}
RunProcesses reports whether the execution that recorded an attempt still owns its dag-run.
type StaleQueueDispatchError ¶
type StaleQueueDispatchError struct {
Reason string
}
StaleQueueDispatchError reports that a scheduler-owned queued dispatch is no longer valid for the latest visible attempt.
func ParseStaleQueueDispatchError ¶
func ParseStaleQueueDispatchError(msg string) (*StaleQueueDispatchError, bool)
ParseStaleQueueDispatchError reconstructs a stale queue-dispatch error from a transport-safe string representation.
func (*StaleQueueDispatchError) Error ¶
func (e *StaleQueueDispatchError) Error() string