chore: make calls to end_all_traces run concurrently (#2387)

This PR makes so that end_all_traces does not block execution.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-26 21:47:56 +00:00 • committed by GitHub
commit 1a01942520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -343,10 +343,10 @@ class Graph:
except Exception as exc:
logger.exception(exc)
tb = traceback.format_exc()
await self.end_all_traces(error=f"{exc.__class__.__name__}: {exc}\n\n{tb}")
asyncio.create_task(self.end_all_traces(error=f"{exc.__class__.__name__}: {exc}\n\n{tb}"))
raise ValueError(f"Error running graph: {exc}") from exc
finally:
await self.end_all_traces()
asyncio.create_task(self.end_all_traces())
# Get the outputs
vertex_outputs = []
for vertex in self.vertices: