Commit 34e9a50
authored
[feat] Provide fine-grained production & consumption status retrieval (#8)
## Background
In previous PR TransferQueue/TransferQueue#157,
a coarse-grained status check was implemented.
Through the following APIs in `TransferQueueClient`, a single boolean
flag is returned to indicate whether all samples are produced or
consumed.
```python3
async def async_check_consumption_status(
self,
task_name: str,
partition_id: str,
socket: Optional[zmq.asyncio.Socket] = None,
) -> bool:
"""Check if all samples for current partition have been consumed by a specific task.
Args:
task_name: Name of the task to check consumption for
partition_id: Partition id to check consumption status for
socket: ZMQ async socket for message transmission (injected by decorator)
Returns:
bool: True if all samples have been consumed by the task, False otherwise
Raises:
RuntimeError: If communication fails or controller returns error response
"""
async def async_check_production_status(
self,
data_fields: list[str],
partition_id: str,
socket: Optional[zmq.asyncio.Socket] = None,
) -> bool:
"""Check if all samples for current partition are ready (produced) for consumption.
Args:
data_fields: Data fields to check production status for
partition_id: Partition id to check production status for
socket: ZMQ async socket for message transmission (injected by decorator)
Returns:
bool: True if all samples have been produced and ready, False otherwise
Raises:
RuntimeError: If communication fails or controller returns error response\
"""
```
# Changes
This PR introduces a fine-grained check mechanism. It provides the
capability that allows users to retrieving the detailed production and
consumption status of every individual sample.
```python3
async def async_get_consumption_status(
self,
task_name: str,
partition_id: str,
socket: Optional[zmq.asyncio.Socket] = None,
) -> tuple[Optional[Tensor], Optional[Tensor]]:
"""Get consumption status for current partition in a specific task.
Args:
task_name: Name of the task to check consumption for
partition_id: Partition id to check consumption status for
socket: ZMQ async socket for message transmission (injected by decorator)
Returns:
Tuple of:
- Partition global index tensor
- Consumption status tensor for the specified task. 1 for consumed, 0 for not consumed.
"""
async def async_get_production_status(
self,
data_fields: list[str],
partition_id: str,
socket: Optional[zmq.asyncio.Socket] = None,
) -> tuple[Optional[Tensor], Optional[Tensor]]:
"""Get production status for current partition in a specific task.
Args:
data_fields: Data fields to check production status for
partition_id: Partition id to check production status for
socket: ZMQ async socket for message transmission (injected by decorator)
Returns:
Tuple of:
- Partition global index tensor
- Production status tensor for the specified task. 1 for ready, 0 for not ready.
Raises:
RuntimeError: If communication fails or controller returns error response
"""
```
CC @NINGBENZHE @walterchenchn
---------
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>1 parent ab06f87 commit 34e9a50
6 files changed
Lines changed: 548 additions & 104 deletions
File tree
- tests
- transfer_queue
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | | - | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | | - | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
467 | 469 | | |
468 | 470 | | |
469 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
470 | 518 | | |
471 | 519 | | |
472 | 520 | | |
| |||
502 | 550 | | |
503 | 551 | | |
504 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
505 | 601 | | |
506 | 602 | | |
507 | 603 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
107 | 113 | | |
108 | 114 | | |
109 | 115 | | |
| |||
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
129 | | - | |
130 | | - | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
137 | 148 | | |
138 | 149 | | |
139 | 150 | | |
| |||
153 | 164 | | |
154 | 165 | | |
155 | 166 | | |
156 | | - | |
157 | | - | |
| 167 | + | |
| 168 | + | |
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
161 | 172 | | |
162 | 173 | | |
163 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
164 | 180 | | |
165 | 181 | | |
166 | 182 | | |
| |||
222 | 238 | | |
223 | 239 | | |
224 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
225 | 254 | | |
226 | 255 | | |
227 | 256 | | |
| |||
234 | 263 | | |
235 | 264 | | |
236 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
237 | 278 | | |
238 | 279 | | |
239 | 280 | | |
| |||
282 | 323 | | |
283 | 324 | | |
284 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
285 | 353 | | |
286 | 354 | | |
287 | 355 | | |
| |||
0 commit comments