Skip to content

Commit

Permalink
Fix cloud-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
satyaog committed Aug 8, 2024
1 parent f21fe27 commit 0f34dd2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 37 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/cloud-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: cloud-tests

on:
# Runs for pull requests
Expand All @@ -8,6 +8,7 @@ on:

permissions:
id-token: write
contents: write

jobs:
cloud-tests:
Expand Down Expand Up @@ -38,7 +39,6 @@ jobs:
MILABENCH_SYSTEM: "config/cloud-system.yaml"
MILABENCH_BASE: "output"
MILABENCH_ARGS: ""
MILABENCH_GPU_ARCH: "${{ matrix.arch }}"
MILABENCH_DASH: "no"
ARM_TENANT_ID: "${{ secrets.ARM_TENANT_ID }}"
ARM_SUBSCRIPTION_ID: "${{ secrets.ARM_SUBSCRIPTION_ID }}"
Expand Down Expand Up @@ -84,30 +84,17 @@ jobs:
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >>~/.aws/credentials
chmod -R a-rwx,u+rwX ~/.aws ~/.ssh
- name: start covalent server
run: |
poetry run -- python3 -m milabench.scripts.covalent serve start --develop
- name: setup cloud
run: |
_system=$(
poetry run milabench cloud \
--setup \
--run-on ${{ matrix.run_on }}
)
{ read _hash ; }< <(
echo -n "$_system" | while read l
do
if [[ "$l" == "# hash::>"* ]]
then
echo -n "${l#*::>}"
fi
done
echo
)
if [[ -z "${_hash}" ]]
then
>&2 echo "Failed to fetch system config hash"
exit 1
fi
echo -n "$_system" >$MILABENCH_SYSTEM.$_hash
echo "MILABENCH_SYSTEM=$MILABENCH_SYSTEM.$_hash" >>$GITHUB_ENV
--run-on ${{ matrix.run_on }} \
--system "$MILABENCH_SYSTEM" >$MILABENCH_SYSTEM.${{ matrix.run_on }}
echo "MILABENCH_SYSTEM=$MILABENCH_SYSTEM.${{ matrix.run_on }}" >>$GITHUB_ENV
- name: install benchmarks
run: |
Expand All @@ -123,10 +110,13 @@ jobs:
- name: Summary
run: |
# git remote set-url origin "https://${{ vars.REPORTS_USERNAME }}:${{ secrets.REPORTS_PAT }}@$(git remote get-url origin | cut -d'/' -f3-)"
git config --global user.email "[email protected]"
git config credential.${{ github.server_url }}.username ${{ github.actor }}
git config credential.helper '!f() { test "$1" = get && echo "password=$GITHUB_TOKEN"; }; f'
git config --global user.email "[email protected]"
git config --global user.name "GitHub CI"
poetry run milabench report --push
env:
GITHUB_TOKEN: ${{ github.token }}

- name: teardown cloud
if: always()
Expand All @@ -139,3 +129,8 @@ jobs:
--teardown \
--run-on ${{ matrix.run_on }} \
--all
- name: debug logs
if: always()
run: |
cat ~/.cache/covalent/covalent_ui.log
27 changes: 14 additions & 13 deletions milabench/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import git
from omegaconf import OmegaConf
from voir.instruments.gpu import deduce_backend, select_backend
import yaml
from milabench import ROOT_FOLDER

from milabench.alt_async import proceed
Expand Down Expand Up @@ -337,20 +336,23 @@ def _push_reports(reports_repo, runs):
}
import milabench.scripts.badges as badges

_repo = git.repo.base.Repo(ROOT_FOLDER)
try:
reports_repo = git.repo.base.Repo(str(reports_repo))
reports_repo = git.Repo(str(reports_repo))
except (git.exc.InvalidGitRepositoryError, git.exc.NoSuchPathError):
_repo = git.Repo(ROOT_FOLDER)
repo_url = next(iter(_r.url for _r in _repo.remotes if _r.name == "origin"), None)
reports_repo = git.repo.base.Repo.clone_from(repo_url, str(reports_repo), branch="reports")

reports_url = ([
url for _r in _repo.remotes for url in _r.urls if "mila-iqia" in url
] or [
url for _r in _repo.remotes for url in _r.urls if _r.name == "origin"
])[0]
reports_url = XPath("github.com".join(reports_url.split("github.com")[1:])[1:])
reports_url = XPath("https://github.com") / f"{reports_url.with_suffix('')}/tree/{reports_repo.active_branch.name}"
reports_repo = git.Repo.clone_from(repo_url, str(reports_repo), branch="reports")
config_reader = _repo.config_reader()
config_writer = reports_repo.config_writer()
for section in config_reader.sections():
if not section.startswith("credential"):
continue
for option in config_reader.options(section):
if not option.strip("_") == option:
continue
for value in config_reader.get_values(section, option):
config_writer.add_value(section, option, value)
config_writer.write()

device_reports = {}
for run in runs:
Expand Down Expand Up @@ -410,7 +412,6 @@ def _push_reports(reports_repo, runs):
"--left-text", device,
"--right-text", text,
"--right-color", _SVG_COLORS[text],
"--whole-link", str(reports_url / build / device)
],
capture_output=True,
check=True
Expand Down

0 comments on commit 0f34dd2

Please sign in to comment.