Skip to content

Commit

Permalink
refactor conda caching and specify cache folder
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanWalsh committed Aug 16, 2024
1 parent d80be72 commit fe09064
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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')]

Expand Down Expand Up @@ -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
Expand All @@ -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)'
Expand All @@ -275,36 +275,15 @@ 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
- bash: |
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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fe09064

Please sign in to comment.