Get sessions and convert them to traces with parallel processing
(offset: int, limit: int)
| 247 | |
| 248 | |
| 249 | async def get_sessions_as_traces(offset: int, limit: int) -> AsyncGenerator[Trace, None]: |
| 250 | """Get sessions and convert them to traces with parallel processing""" |
| 251 | sessions = await get_sessions(offset, limit) |
| 252 | for i in range(0, len(sessions), PARALLEL_READS): |
| 253 | batch = sessions[i : i + PARALLEL_READS] |
| 254 | tasks = [asyncio.create_task(get_session_as_trace(session)) for session in batch] |
| 255 | for task in asyncio.as_completed(tasks): |
| 256 | trace = await task |
| 257 | print(trace.id) |
| 258 | yield trace |
| 259 | |
| 260 | |
| 261 | # Cache for session_id to project_id mapping |
no test coverage detected
searching dependent graphs…