Closed thy09 closed 2 weeks ago
4 files 4 suites 4m 8s :stopwatch: 238 tests 203 :white_check_mark: 35 :zzz: 0 :x: 952 runs 812 :white_check_mark: 140 :zzz: 0 :x:
Results for commit f54a67fd.
:recycle: This comment has been updated with latest results.
0 tests 0 :white_check_mark: 0s :stopwatch: 0 suites 0 :zzz: 0 files 0 :x:
Results for commit f54a67fd.
:recycle: This comment has been updated with latest results.
6 tests 6 :white_check_mark: 1m 21s :stopwatch: 1 suites 0 :zzz: 1 files 0 :x:
Results for commit f54a67fd.
:recycle: This comment has been updated with latest results.
792 tests 792 :white_check_mark: 3m 42s :stopwatch: 1 suites 0 :zzz: 1 files 0 :x:
Results for commit f54a67fd.
:recycle: This comment has been updated with latest results.
242 tests 237 :white_check_mark: 5m 10s :stopwatch: 1 suites 5 :zzz: 1 files 0 :x:
Results for commit f54a67fd.
:recycle: This comment has been updated with latest results.
4 files 4 suites 58m 41s :stopwatch: 668 tests 655 :white_check_mark: 13 :zzz: 0 :x: 2 672 runs 2 620 :white_check_mark: 52 :zzz: 0 :x:
Results for commit f54a67fd.
:recycle: This comment has been updated with latest results.
Description
Refine exec_line logic to support async generator in flow test.
This pull request primarily focuses on improving the handling of generators and asynchronous generators in the
promptflow
package. The changes ensure that the code can handle both synchronous and asynchronous generators, improve the handling of generator outputs, and refactor the way nodes are executed in the flow.Here are the key changes:
Improved handling of generators and asynchronous generators:
src/promptflow-core/promptflow/_core/run_tracker.py
: Theinspect
module was imported to replace the use ofGeneratorType
for checking if a value is a generator. The methodupdate_and_persist_generator_node_runs
was introduced to replacepersist_selected_node_runs
, and it now updates the output of the node run with the output in the trace before persisting it. [1] [2] [3]src/promptflow-core/promptflow/_utils/run_tracker_utils.py
: Theinspect
module was imported, and the method_deep_copy_and_extract_items_from_generator_proxy
was updated to handleAsyncGeneratorProxy
and to convert generators to strings to avoid deepcopy errors. [1] [2]Refactoring of node execution:
src/promptflow-core/promptflow/executor/flow_executor.py
: TheThreadPoolExecutorWithContext
was imported frompromptflow.tracing
. In theexec_line
method, a check was added to useexec_line_async
when the tools are async. Theexec_line_async
method was updated to include aline_timeout_sec
parameter. The_exec_inner_with_trace_async
method was updated to use_stringify_generator_output_async
to handle async generator output. The_exec_post_process
method was updated to useupdate_and_persist_generator_node_runs
instead ofpersist_selected_node_runs
. The_should_use_async
method was updated to check if any tool is async. The_traverse_nodes_async
method was updated to use an async scheduler. The methods_merge_async_generator
,_stringify_generator_output_async
, and_merge_generator
were added to handle generator outputs. The_submit_to_scheduler
method was updated to only use the thread pool mode. [1] [2] [3] [4] [5] [6] [7] [8]All Promptflow Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines