feat: support set environment variables on flow.dag.yaml #34450
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request primarily involves changes to the Azure AI ML SDK, with a focus on handling environment variables when loading
flow.dag.yamlas a component and modifying test cases.Environment Variables:
sdk/ml/azure-ai-ml/assets.json: The tag was updated frompython/ml/azure-ai-ml_2ff0425fbftopython/ml/azure-ai-ml_baea630318.sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/flow.py: A dictionary for environment variables was added to_FlowComponentOverridableSchema.sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/flow.py: The handling of environment variables was changed in the__init__method, with the variables now being read fromflow_contentand updated with any additional variables [1] [2].Test Cases:
sdk/ml/azure-ai-ml/scripts/run_tests.py: Therun_simplemethod was modified to openstdoutin text mode instead of binary mode and to not check the output of the subprocess call [1] [2].sdk/ml/azure-ai-ml/tests/component/unittests/test_flow_component.py: Thetest_component_load_from_dagmethod was updated to include a set of environment variables and a newclient_component_hash.sdk/ml/azure-ai-ml/tests/pipeline_job/e2etests/test_pipeline_job.py: Thetest_pipeline_job_with_flowmethod was modified to assert the validation result message in addition to the pass status.Test Configurations:
sdk/ml/azure-ai-ml/tests/test_configs/flows/basic/hello.py: Several changes were made, including the import ofVERSIONfromopenai.version, the addition of aget_clientfunction, and modifications to themy_python_toolfunction to use the new client and check for theAZURE_OPENAI_API_KEYenvironment variable [1] [2] [3] [4].Environment Variable Removal:
sdk/ml/azure-ai-ml/tests/test_configs/flows/runs/basic_run.yml: TheAZURE_OPENAI_API_TYPEandAZURE_OPENAI_API_VERSIONenvironment variables were removed.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines