-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: always release resources in chat ui for csharp (#2427)
# Description Although new chat UI doesn't support streaming for now, PFS will call flow operation with `stream_output` as `True`, which may bring some issues in resource release. In this PR, we avoid that. Improvements to the `TestSubmitter`: * [`src/promptflow/promptflow/_sdk/_submitter/test_submitter.py`](diffhunk://#diff-d9dd2c09a149b11eb54626edf065287eeb7b1a28e39719b8dd95377770f64138R287-R289): The `destroy_if_all_generators_exhausted` method has been replaced with the `destroy` method in the `TestSubmitter` class. This change is accompanied by a comment noting that the current implementation may not properly release resources. Changes to the test submission process: * [`src/promptflow/promptflow/_sdk/data/executable/main.py`](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cR14-L20): The `TestSubmitter` class is now used in the `submit` function to handle test submissions. This change simplifies the submission process by removing the need for the `run_flow` function. [[1]](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cR14-L20) [[2]](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cL74-R78) [[3]](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cL104-L123) Codebase simplification: * [`src/promptflow/promptflow/_sdk/data/executable/main.py`](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cL104-L123): The `invoker` global variable and the `run_flow` function have been removed, and a `resolve_flow_path` function has been added to handle the flow path resolution. [[1]](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cL104-L123) [[2]](diffhunk://#diff-c22ed7aec6ed0b5a5fde51716818d5695b917ab38cc385ee7e65390471fb723cR195-R212) * [`src/promptflow/promptflow/_sdk/entities/_flow/dag.py`](diffhunk://#diff-fe4826ecd0e92a94a1769ec7376562b483dcb666b54acd0e6396d6262cbf5f2eR149-R151): A comment has been added to the `invoke` method in the `Flow` class, indicating that the use of a context manager for `stream_output` is not appropriate. * [`src/promptflow/promptflow/batch/_base_executor_proxy.py`](diffhunk://#diff-44ac8eeb30a630bd24987e92f8bd5a180d57a3ad067db5d937561f21771e14c5L232-R238): The `destroy_if_all_generators_exhausted` method now raises an `UnexpectedError` if all generators are not exhausted, and the `enable_stream_output` parameter has been removed from the `exec_line` method. [[1]](diffhunk://#diff-44ac8eeb30a630bd24987e92f8bd5a180d57a3ad067db5d937561f21771e14c5L232-R238) [[2]](diffhunk://#diff-44ac8eeb30a630bd24987e92f8bd5a180d57a3ad067db5d937561f21771e14c5L323-L324) # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
- Loading branch information
Showing
8 changed files
with
112 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters