<#831 implement sync traces> Pull request opened b...
# flyte-github
a
#831 implement sync traces Pull request opened by cosmicBboy This pull request introduces synchronous tracing support for Flyte tasks, allowing the use of the
@flyte.trace
decorator on regular (non-async) Python functions. The main changes add the ability to record traces for synchronous tasks, update the controller interfaces to support blocking coroutine execution, and provide new examples and tests for sync tracing. Synchronous tracing support: • Implemented synchronous tracing logic in the
@flyte.trace
decorator, enabling trace recording for plain (sync) functions by running the trace logic in a blocking manner (
run_coroutine_blocking
) instead of requiring async/await. • Added a new example (
examples/basics/trace_sync.py
) demonstrating how to use
@flyte.trace
with synchronous tasks and functions. Controller interface and implementation updates: • Added a
run_coroutine_blocking
method to the controller interface and both local and remote controller implementations, allowing synchronous code to execute coroutines on the controller's event loop and block until completion. [1] [2] [3] [4] Testing and validation: • Added new tests to verify that synchronous traced functions and tasks work as expected, including a traced sync function (
sync_square
) and a sync task (
sync_traces_loop
) with corresponding test cases. [1] [2] [3] flyteorg/flyte-sdk