Merge branch 'master' of github.com:skypilot-org/skypilot-catalog int… #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "update-aws-catalog" | ||
on: | ||
schedule: | ||
- cron: '00 */7 * * *' # Every 7 hours (coprimes with 24) | ||
# The frequency can be tuned for the trade-off between | ||
# freshness of the price and github action cost/user downloading | ||
# overhead of the update. | ||
# _UPDATE_FREQUENCY_HOURS in `aws_catalog.py` need to be updated | ||
# accordingly, if this is changed. | ||
workflow_dispatch: | ||
jobs: | ||
update_aws_catalog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone SkyPilot repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: skypilot-org/skypilot | ||
path: sky | ||
- name: Clone Catalog repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
path: catalogs | ||
token: ${{ secrets.GH_ACTION_PAT }} | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
cache: 'pip' # caching pip dependencies | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
cd sky | ||
pip install "." | ||
- name: Run accelerators aggregations | ||
run: | | ||
version=$(python -c 'import sky; print(sky.clouds.service_catalog.constants.CATALOG_SCHEMA_VERSION)') | ||
mkdir -p catalogs/catalogs/$version | ||
cd catalogs/catalogs/$version | ||
mkdir -p common | ||
python -u -c " | ||
from sky.clouds import service_catalog | ||
import pandas as pd | ||
acc_cloud = list(zip(*[ | ||
[k, sorted(list(set(info.cloud for info in infos)))] | ||
for k, infos in service_catalog.list_accelerators().items() | ||
])) | ||
pd.DataFrame({ | ||
'AcceleratorName': acc_cloud[0], | ||
'Clouds': acc_cloud[1] | ||
}).sort_values(by='AcceleratorName').to_csv('common/accelerators.csv', index=False) | ||
" | ||
- name: Commit catalog | ||
run: | | ||
version=$(python -c 'import sky; print(sky.clouds.service_catalog.constants.CATALOG_SCHEMA_VERSION)') | ||
cd catalogs | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add . | ||
git commit -m"[Bot] Update accelerators (scheduled at $(date))" || { echo "No changes to commit" && exit 0; } | ||
git fetch origin | ||
git rebase origin/master | ||
git push |