Get task data by task ID. Args: task_id: Task identifier Returns: Task data dictionary or None if not found
(task_id: str)
| 201 | |
| 202 | |
| 203 | def get_task_data(task_id: str) -> Optional[JobData]: |
| 204 | """Get task data by task ID. |
| 205 | |
| 206 | Args: |
| 207 | task_id: Task identifier |
| 208 | |
| 209 | Returns: |
| 210 | Task data dictionary or None if not found |
| 211 | """ |
| 212 | cursor = 0 |
| 213 | |
| 214 | while True: |
| 215 | cursor, fields = _get_redis_client().hscan( |
| 216 | TASKS_HASH_NAME, |
| 217 | cursor, |
| 218 | match=f"*:*:{task_id}", |
| 219 | ) |
| 220 | |
| 221 | for _, task_data in fields.items(): |
| 222 | try: |
| 223 | return JobData(**json.loads(task_data)) |
| 224 | except (json.JSONDecodeError, KeyError, TypeError): |
| 225 | continue |
| 226 | |
| 227 | if cursor == 0: |
| 228 | break |
| 229 | |
| 230 | return None |
| 231 | |
| 232 | |
| 233 | def get_queue_length() -> int: |
searching dependent graphs…