From 358b519e14163c9087e778cfe8ff3b603ef88300 Mon Sep 17 00:00:00 2001 From: Jay Zhang <36183870+fatcat-z@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:27:33 +0800 Subject: [PATCH] Azure pipeline task CondaEnvironment@1 has been deprecated. (#2309) * Replace CondaEnvironment@1 azure task with UsePythonVersion@0. * Remove unnecessary steps. --------- Signed-off-by: Jay Zhang --- .../templates/combine_test_coverage.yml | 8 +++----- .../templates/job_generator.yml | 18 +++--------------- .../templates/keras2onnx_application_tests.yml | 12 +++--------- .../templates/keras2onnx_unit_test.yml | 15 +++------------ 4 files changed, 12 insertions(+), 41 deletions(-) diff --git a/ci_build/azure_pipelines/templates/combine_test_coverage.yml b/ci_build/azure_pipelines/templates/combine_test_coverage.yml index f31b25c3b..53d573abf 100644 --- a/ci_build/azure_pipelines/templates/combine_test_coverage.yml +++ b/ci_build/azure_pipelines/templates/combine_test_coverage.yml @@ -20,12 +20,10 @@ stages: artifactName: '${{ parameters.artifact_name }}' downloadPath: $(System.DefaultWorkingDirectory) - - task: CondaEnvironment@1 + - task: UsePythonVersion@0 inputs: - createCustomEnvironment: 'true' - environmentName: 'tf2onnx' - packageSpecs: 'python=3.7' - updateConda: 'false' + versionSpec: '3.7' + architecture: 'x64' - bash: | pip install -U coverage diff --git a/ci_build/azure_pipelines/templates/job_generator.yml b/ci_build/azure_pipelines/templates/job_generator.yml index 811949d00..826ff03c6 100644 --- a/ci_build/azure_pipelines/templates/job_generator.yml +++ b/ci_build/azure_pipelines/templates/job_generator.yml @@ -78,22 +78,10 @@ jobs: - bash: env displayName: 'Display Environment Variables' -# TODO: ordinary python is preferred but built-in python3.6 does not have libpython3.6m.so, onnxruntime will fail with -# Error: 'libpython3.6m.so.1.0: cannot open shared object file: No such file or directory' -# so have to use conda here, may switch back to UsePythonVersion when the issue is fixed. -# - task: UsePythonVersion@0 -# inputs: -# versionSpec: '$(CI_PYTHON_VERSION)' -# architecture: 'x64' - -# TODO: Conda Environment task is deprecating, move to raw python after issue above is fixed. -# https://github.com/Microsoft/azure-pipelines-tasks/pull/9573 - - task: CondaEnvironment@1 + - task: UsePythonVersion@0 inputs: - createCustomEnvironment: 'true' - environmentName: 'tf2onnx' - packageSpecs: 'python=$(CI_PYTHON_VERSION)' - updateConda: 'false' + versionSpec: '$(CI_PYTHON_VERSION)' + architecture: 'x64' - ${{ if eq(parameters.run_setup, 'True') }}: - template: 'setup.yml' diff --git a/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml b/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml index 61d0eb2ad..2c4a54e7c 100644 --- a/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml +++ b/ci_build/azure_pipelines/templates/keras2onnx_application_tests.yml @@ -9,11 +9,10 @@ steps: - script: sudo install -d -m 0777 /home/vsts/.conda/envs displayName: Fix Conda permissions - - task: CondaEnvironment@1 + - task: UsePythonVersion@0 inputs: - createCustomEnvironment: true - environmentName: 'py$(python.version)' - packageSpecs: 'python=$(python.version)' + versionSpec: '$(python.version)' + architecture: 'x64' - script: | python -m pip install --upgrade pip @@ -80,11 +79,7 @@ steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Add conda to PATH - - script: conda create --yes --quiet --name py$(python.version) -c conda-forge python=$(python.version) numpy protobuf~=3.20 - displayName: Create Anaconda environment - - script: | - call activate py$(python.version) python -m pip install --upgrade pip numpy echo Test numpy installation... && python -c "import numpy" pip install onnxconverter-common @@ -119,7 +114,6 @@ steps: displayName: 'Install dependencies' - script: | - call activate py$(python.version) pip install -e . echo Test onnxruntime installation... && python -c "import onnxruntime" pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml diff --git a/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml b/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml index e0f6cd54b..adb436f0a 100644 --- a/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml +++ b/ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml @@ -9,11 +9,10 @@ steps: - script: sudo install -d -m 0777 /home/vsts/.conda/envs displayName: Fix Conda permissions - - task: CondaEnvironment@1 + - task: UsePythonVersion@0 inputs: - createCustomEnvironment: true - environmentName: 'py$(python.version)' - packageSpecs: 'python=$(python.version)' + versionSpec: '$(python.version)' + architecture: 'x64' - script: | python -m pip install --upgrade pip @@ -63,14 +62,7 @@ steps: versionSpec: '$(python.version)' architecture: 'x64' - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH - - - script: conda create --yes --quiet --name py$(python.version) -c conda-forge python=$(python.version) numpy protobuf~=3.20 - displayName: Create Anaconda environment - - script: | - call activate py$(python.version) python -m pip install --upgrade pip numpy echo Test numpy installation... && python -c "import numpy" pip install onnxconverter-common @@ -91,7 +83,6 @@ steps: displayName: 'Install dependencies' - script: | - call activate py$(python.version) pip install -e . echo Test onnxruntime installation... && python -c "import onnxruntime" python -c "import onnxconverter_common"