Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK][Local] Support additional includes for eager flow test (#1808)
# Description This pull request includes a wide range of changes to various files in the `promptflow` project. The most important changes include modifications to improve code organization, attribute access, and method signatures in the `_flow` class, as well as the addition of a new `Notification::Cache` class for interacting with a cache using a `PStore` object. Main changes: * [`src/promptflow/promptflow/_sdk/entities/_flow.py`](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL138-R164): Modified the `_flow` class to improve code organization and attribute access, add a new attribute, and update method signatures. [[1]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL138-R164) [[2]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL111-R135) [[3]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL193-R198) [[4]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL210-R209) [[5]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL260-R261) [[6]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL348-R349) [[7]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL95-R103) [[8]](diffhunk://#diff-339752a6e9c04159a62708efed6b385bd91b016a0f0d2edeb32024fd19886a2bL236-R249) * [`src/promptflow/promptflow/_sdk/_submitter/utils.py`](diffhunk://#diff-38c78274ff4a19381a2129bfd86174d225e0d8537b48c80aa8f6feaca25083abL159-R164): Modified the `variant_overwrite_context()` function to handle both `EagerFlow` and `ProtectedFlow` objects, and modified the `resolve_used_connections()` function to replace `flow.dag` with `flow._data`. [[1]](diffhunk://#diff-38c78274ff4a19381a2129bfd86174d225e0d8537b48c80aa8f6feaca25083abL159-R164) [[2]](diffhunk://#diff-38c78274ff4a19381a2129bfd86174d225e0d8537b48c80aa8f6feaca25083abR173-R175) [[3]](diffhunk://#diff-38c78274ff4a19381a2129bfd86174d225e0d8537b48c80aa8f6feaca25083abL218-R222) [[4]](diffhunk://#diff-38c78274ff4a19381a2129bfd86174d225e0d8537b48c80aa8f6feaca25083abL150-R150) [[5]](diffhunk://#diff-38c78274ff4a19381a2129bfd86174d225e0d8537b48c80aa8f6feaca25083abL35-R40) * [`src/promptflow/promptflow/_sdk/_submitter/run_submitter.py`](diffhunk://#diff-e3499cf713c66612d91723759de1c5076c22689b2ce2c89678f82de624b57c2cL63-R64): Modified the `_run_bulk()` method to remove the check for `local_storage.eager_mode` and call `load_flow()` with `flow_obj` instead of `run.flow`. * [`src/promptflow/promptflow/_sdk/operations/_flow_operations.py`](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L15-R15): Various changes to ensure the correct flow objects and attributes are used for building and exporting flow connections, and to remove unnecessary imports and add necessary imports. [[1]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L15-R15) [[2]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L412-R412) [[3]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L444-R444) [[4]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L453-R453) [[5]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L428-R428) [[6]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L32-R32) [[7]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L587-R587) [[8]](diffhunk://#diff-afdd40a5d0519512dcf9be48bd46c4caaa2291b808687de77896989af63f47e4L604-R604) Testing improvements: * [`src/promptflow/tests/sdk_cli_test/unittests/test_run.py`](diffhunk://#diff-c3d1c4e4539af1a59525218043dad93dc866b761a70a16a21783e57a7d0adac5R29-R50): Added a new fixture, modified an existing method, and updated an import statement. [[1]](diffhunk://#diff-c3d1c4e4539af1a59525218043dad93dc866b761a70a16a21783e57a7d0adac5R29-R50) [[2]](diffhunk://#diff-c3d1c4e4539af1a59525218043dad93dc866b761a70a16a21783e57a7d0adac5L14-R19) [[3]](diffhunk://#diff-c3d1c4e4539af1a59525218043dad93dc866b761a70a16a21783e57a7d0adac5L71-R81) * [`src/promptflow/tests/sdk_cli_test/e2etests/test_flow_run.py`](diffhunk://#diff-94a59a05643476869fa3c6bc45466f1582944a935488075e2e63b6a6a196958fR1248): Added a TODO comment for future reference and added a new test method to test flow runs with additional included files. [[1]](diffhunk://#diff-94a59a05643476869fa3c6bc45466f1582944a935488075e2e63b6a6a196958fR1248) [[2]](diffhunk://#diff-94a59a05643476869fa3c6bc45466f1582944a935488075e2e63b6a6a196958fR1269-R1278) * [`src/promptflow/tests/test_configs/eager_flows/flow_with_additional_includes/flow.py`](diffhunk://#diff-d9a0b6426d2e584a65983c8fa36cfb185397924c6faba503480c82c006243fbeR1-R7): Added a new entry function `my_flow_entry` to the `flow.py` file. * [`src/promptflow/tests/test_configs/eager_flows/flow_with_additional_includes/flow.dag.yaml`](diffhunk://#diff-a1826a5844be209b8e39da157975cc6ea52e41463dd40b44a48a63c491e37ebbR1-R4): Modified the `flow.dag.yaml` file to update the configuration of the flow DAG. * [`src/promptflow/tests/sdk_cli_test/e2etests/test_flow_test.py`](diffhunk://#diff-acf3c2285ac2a7051d59e3a69abe02224e2d6d5d69e3a0aabd2afd9311f87657R251-R257): Added a new test method `test_eager_flow_test_with_additional_includes` to the `test_flow_test.py` file. * [`src/promptflow/promptflow/_sdk/_submitter/test_submitter.py`](diffhunk://#diff-d9dd2c09a149b11eb54626edf065287eeb7b1a28e39719b8dd95377770f64138L61-R70): Modified the `dataplane_flow` method to use a single context manager to handle both eager flow initialization and DAG flow initialization. # 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