Skip to content

Commit

Permalink
asv machine --yes
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgi Rusev authored and Georgi Rusev committed Jan 10, 2025
1 parent 3553540 commit 762e09a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/asv_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
git config --global --add safe.directory .
python -m pip install --upgrade pip
pip install asv
asv machine --yes
- name: Build project for ASV
run: |
Expand Down
30 changes: 20 additions & 10 deletions python/utils/asv_checks.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import hashlib
import os
import re
import subprocess
import sys
from typing import List


def error(mes):
print("-" * 80)
print(f"ERROR :{mes}", file=sys.stderr )
print(f"ERROR (same error printed on stdout also)): {mes}")
print("-" * 80)


def run_command(command: List[str], cwd: str, ok_error: str = None) -> int:
def run_command(command: List[str], cwd: str, ok_errors_list: List[str] = None) -> int:
"""
executes a command in specified directory.
if 'ok_error' passed, the string will be searched in stderr
Expand All @@ -21,19 +25,25 @@ def run_command(command: List[str], cwd: str, ok_error: str = None) -> int:
err_output = result.stderr
error_code = result.returncode

if error_code != 0:
print(f"Error Code: {error_code}")
if not err_output is None:
error(err_output)
if error_code == 0:
print("ABOVE ERRORS DOES NOT AFFECT FINAL ERROR CODE = 0")

if not output is None:
print("Output:")
print("Standard Output:")
print(output)

if not err_output is None:
error(err_output)
if not ok_error is None:
if (ok_error in err_output):
print("Above error is ok!")
if error_code != 0:
print(f"Error Code Returned: {error_code}")
if not ok_errors_list is None:
for ok_error in ok_errors_list:
err_output.replace(ok_error, "")
err_output = re.sub(r'\s+', '', err_output)
if err_output == "":
error_code = 0
else:
error(f"Unknown errors: {err_output}" )

return error_code

Expand Down Expand Up @@ -91,7 +101,7 @@ def perform_asv_checks() -> int:
print("\n\nCheck 2: Check that benchmarks.json has up to date latest versions of tests.")
if run_command(command = ["asv", "run", "--bench", "just-discover", "--python=same"],
cwd = path,
ok_error ="Couldn't load asv.plugins._mamba_helpers") != 0:
ok_errors_list = ["Couldn't load asv.plugins._mamba_helpers"]) != 0:
error("There was error getting latest benchmarks. See log")
err = 1
else:
Expand Down

0 comments on commit 762e09a

Please sign in to comment.