cache-dependencies-template.yml 3.44 KB
Newer Older
1
2
3
4
parameters:
- name: platform
  type: string

5
6
7
8
9
10
11
12
13
14
# 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

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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'))

30
31
32
33
34
- script: |
    mv dependencies/recommended_gpu.txt dependencies/recommended.txt
  displayName: (GPU) Activate CUDA dependencies
  condition: and(succeeded(), contains('${{ parameters.platform }}', 'gpu'))

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
- 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: |
    yarn --cwd ts/nni_manager install
  displayName: Install NNI Manager dependencies

- script: |
    yarn --cwd ts/webui install
  displayName: Install Web UI dependencies

- script: |
81
    python test/vso_tools/pack_dependencies.py dependencies.zip
82
83
  displayName: Create cache archive

84
85
86
87
88
89
90
91
92
- 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'))