nni/pipelines/templates/cache-dependencies-template...

108 строки
4.0 KiB
YAML

parameters:
- name: platform
type: string
# variables set on VSO: (for security concern)
# sas_token
#
# its value should be:
# sp=racw&st=2022-04-01T00:00:00Z&se=......
#
# how to re-generate:
# 1. find the storage on azure portal: nni (resource group) -> nni (storage account) -> cache (container)
# 2. settings - shared access tokens - generate sas token and url
steps:
- template: config-version.yml
parameters:
platform: ${{ parameters.platform }}
- script: |
echo "##vso[task.setvariable variable=PLATFORM]${{ parameters.platform }}"
python test/vso_tools/pip_use_prefix.py python-packages
displayName: Prepare
- script: |
cp dependencies/recommended_legacy.txt dependencies/recommended.txt
displayName: (legacy) Activate legacy dependencies
condition: and(succeeded(), contains('${{ parameters.platform }}', 'legacy'))
- script: |
mv dependencies/recommended_gpu.txt dependencies/recommended.txt
displayName: (GPU) Activate CUDA dependencies
condition: and(succeeded(), contains('${{ parameters.platform }}', 'gpu'))
- script: |
set -e
echo '===== develop ====='
./pip-install -r dependencies/develop.txt
echo '===== required ====='
./pip-install -r dependencies/required.txt
echo '===== required extra ====='
./pip-install -r dependencies/required_extra.txt
echo '===== recommended ====='
./pip-install -r dependencies/recommended.txt
echo '===== fix shebang ====='
python test/vso_tools/fix_shebang.py python-packages/bin
displayName: (POSIX) Install Python packages
condition: and(succeeded(), not(contains('${{ parameters.platform }}', 'windows')))
# FIXME: It does not stop on failure. Tried "ErrorActionPreference" with no luck.
- powershell: |
echo '===== develop ====='
./pip-install -r dependencies/develop.txt
echo '===== required ====='
./pip-install -r dependencies/required.txt
echo '===== required extra ====='
./pip-install -r dependencies/required_extra.txt
echo '===== recommended ====='
./pip-install -r dependencies/recommended.txt
displayName: (Windows) Install Python packages
condition: and(succeeded(), contains('${{ parameters.platform }}', 'windows'))
# FIXME:
# numpy version may change several times during installation, and it has an ABI change in recent versions.
# We must make sure ConfigSpaceNNI is built against correct numpy version, or it will fail on import.
- script: |
python -m pip uninstall -y ConfigSpaceNNI
./pip-install --no-cache-dir ConfigSpaceNNI
displayName: (Ubuntu) Rebuild ConfigSpaceNNI
condition: and(succeeded(), contains('${{ parameters.platform }}', 'ubuntu'))
- script: |
cd ts/nni_manager
npm install
displayName: Install NNI Manager dependencies
condition: and(succeeded(), not(contains('${{ parameters.platform }}', 'legacy')))
- script: |
# make pack_dependencies.py happy
mkdir ts/nni_manager/node_modules
displayName: (Legacy) Skip NNI Manager dependencies
condition: and(succeeded(), contains('${{ parameters.platform }}', 'legacy'))
- script: |
cd ts/webui
npm install
displayName: Install Web UI dependencies
condition: and(succeeded(), not(contains('${{ parameters.platform }}', 'legacy')))
- script: |
mkdir ts/webui/node_modules
displayName: (Legacy) Skip Web UI dependencies
condition: and(succeeded(), contains('${{ parameters.platform }}', 'legacy'))
- script: |
python test/vso_tools/pack_dependencies.py dependencies.zip
displayName: Create cache archive
- script: |
azcopy copy dependencies.zip 'https://nni.blob.core.windows.net/cache/dependencies-${{ parameters.platform }}.zip?$(sas_token)'
displayName: (POSIX) Upload cache archive
condition: and(succeeded(), not(contains('${{ parameters.platform }}', 'windows')))
- powershell: |
azcopy copy dependencies.zip 'https://nni.blob.core.windows.net/cache/dependencies-${{ parameters.platform }}.zip?$(sas_token)'
displayName: (Windows) Upload cache archive
condition: and(succeeded(), contains('${{ parameters.platform }}', 'windows'))