From fe09064ab31a572224f7a81e3a55a360baaa71a4 Mon Sep 17 00:00:00 2001 From: Brendan Walsh Date: Thu, 15 Aug 2024 20:13:02 -0700 Subject: [PATCH] refactor conda caching and specify cache folder --- pipeline.yaml | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/pipeline.yaml b/pipeline.yaml index a6d5489b8d..d098339ed7 100644 --- a/pipeline.yaml +++ b/pipeline.yaml @@ -53,7 +53,8 @@ parameters: variables: runTests: True - CONDA_CACHE_DIR: /usr/share/miniconda/envs + CONDA_ENV: synapseml + CONDA_CACHE_DIR: /usr/share/miniconda/envs/$(CONDA_ENV)/ ComponentDetection.Timeout: 900 isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')] @@ -253,6 +254,7 @@ jobs: cancelTimeoutInMinutes: 0 pool: vmImage: ubuntu-20.04 + condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) steps: - template: templates/checkout.yml - template: templates/update_cli.yml @@ -264,9 +266,7 @@ jobs: wget https://github.com/git-chglog/git-chglog/releases/download/0.8.0/git-chglog_linux_amd64 chmod +x git-chglog_linux_amd64 ./git-chglog_linux_amd64 -o CHANGELOG.md $TAG - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) - task: GitHubRelease@0 - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) inputs: gitHubConnection: 'MMLSpark Github' repositoryName: '$(Build.Repository.Name)' @@ -275,28 +275,8 @@ jobs: tagSource: 'auto' releaseNotesFile: 'CHANGELOG.md' isDraft: true - - bash: echo "##vso[task.prependpath]$CONDA/bin" - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) - displayName: Add conda to PATH - - bash: sudo chown -R $(whoami):$(id -ng) $(CONDA_CACHE_DIR) - displayName: Fix directory permissions - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) - - task: Cache@2 - displayName: Use cached Anaconda environment - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) - inputs: - key: 'conda | "$(Agent.OS)" | environment.yml' - restoreKeys: | - python | "$(Agent.OS)" - python - path: $(CONDA_CACHE_DIR) - cacheHitVar: CONDA_CACHE_RESTORED - - bash: | - conda env create --force -f environment.yml -v - condition: and(eq(variables.isMaster, true), and(startsWith(variables['tag'], 'v'), eq(variables.CONDA_CACHE_RESTORED, 'false'))) - displayName: Create Anaconda environment + - template: templates/conda.yml - task: AzureKeyVault@1 - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) inputs: azureSubscription: 'SynapseML Build' keyVaultName: mmlspark-keys @@ -304,7 +284,6 @@ jobs: set -e source activate synapseml sbt publishPypi - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) env: STORAGE-KEY: $(storage-key) NEXUS-UN: $(nexus-un) @@ -320,7 +299,6 @@ jobs: source activate synapseml sbt publishLocalSigned python tools/esrp/prepare_jar.py - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) env: STORAGE-KEY: $(storage-key) NEXUS-UN: $(nexus-un) @@ -350,7 +328,6 @@ jobs: DomainTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' waitforreleasecompletion: true displayName: 'ESRP Publish Package' - condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v')) - job: PythonTests