Skip to content

Commit

Permalink
chore: add conda env caching (#2207)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamilton723 authored Apr 17, 2024
1 parent d789b02 commit 07b2451
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions templates/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
retryCountOnTaskFailure: 1
# - bash: sudo chown -R $(whoami):$(id -ng) $(CONDA_CACHE_DIR)
# displayName: Fix directory permissions
# - task: Cache@2
# displayName: Use cached Anaconda environment
# inputs:
# key: 'conda | "$(Agent.OS)" | environment.yml'
# restoreKeys: |
# python | "$(Agent.OS)"
# python
# path: $(CONDA_CACHE_DIR)
# cacheHitVar: CONDA_CACHE_RESTORED
- bash: sudo chown -R $(whoami):$(id -ng) $(CONDA_CACHE_DIR)
displayName: Fix directory permissions
- task: Cache@2
displayName: Use cached Anaconda environment
inputs:
key: 'conda | "$(Agent.OS)" | environment.yml'
restoreKeys: |
python | "$(Agent.OS)"
python
path: $(CONDA_CACHE_DIR)
cacheHitVar: CONDA_CACHE_RESTORED
timeoutInMinutes: 20
retryCountOnTaskFailure: 1
- bash: |
(timeout 30m conda env create --force -f environment.yml -v) || (timeout 30m conda env create --force -f environment.yml -v)
displayName: Create Anaconda environment
retryCountOnTaskFailure: 1
# condition: eq(variables.CONDA_CACHE_RESTORED, 'false')
condition: eq(variables.CONDA_CACHE_RESTORED, 'false')

0 comments on commit 07b2451

Please sign in to comment.