Context Queue
Queue for managing DAG execution contexts.
Priority-based context queue for DAG executors.
AsyncContextQueue
Asynchronous interface for the context queue.
Source code in shutils/dag/context_queue.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
__init__(context_queue)
Initialize with the underlying context queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context_queue
|
ContextQueue
|
The shared context queue instance. |
required |
Source code in shutils/dag/context_queue.py
104 105 106 107 108 109 110 | |
get()
async
Async get the highest-priority context from the queue.
Source code in shutils/dag/context_queue.py
112 113 114 115 | |
put(context, priority=ContextPriority.FIFO_HIGH)
async
Async put a context into the queue with the given priority.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context to enqueue. |
required |
priority
|
ContextPriority
|
The priority level for scheduling. |
FIFO_HIGH
|
Source code in shutils/dag/context_queue.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
ContextPriority
Bases: Enum
Priority levels for context scheduling.
Source code in shutils/dag/context_queue.py
20 21 22 23 24 25 | |
ContextQueue
Priority queue for contexts with sync and async interfaces.
Source code in shutils/dag/context_queue.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
async_queue
property
Lazy accessor for the asynchronous queue interface.
sync_queue
property
Lazy accessor for the synchronous queue interface.
__init__()
Initialize the context queue with per-priority counters.
Source code in shutils/dag/context_queue.py
44 45 46 47 48 49 50 51 52 | |
PrioritizedItem
dataclass
Context queue item with priority and sequence for ordering.
Attributes:
| Name | Type | Description |
|---|---|---|
priority |
int
|
Numeric priority value. |
sequence |
int
|
Sequence number for ordering within the same priority. |
item |
Context
|
The context payload. |
Source code in shutils/dag/context_queue.py
27 28 29 30 31 32 33 34 35 36 37 38 | |
SyncContextQueue
Synchronous blocking interface for the context queue.
Source code in shutils/dag/context_queue.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
__init__(context_queue)
Initialize with the underlying context queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context_queue
|
ContextQueue
|
The shared context queue instance. |
required |
Source code in shutils/dag/context_queue.py
71 72 73 74 75 76 77 | |
get()
Get the highest-priority context from the queue.
Source code in shutils/dag/context_queue.py
79 80 81 | |
put(context, priority=ContextPriority.FIFO_HIGH)
Put a context into the queue with the given priority.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context to enqueue. |
required |
priority
|
ContextPriority
|
The priority level for scheduling. |
FIFO_HIGH
|
Source code in shutils/dag/context_queue.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |