|
2 | 2 |
|
3 | 3 | from math import ceil, isinf |
4 | 4 | from os import chdir, getcwd |
5 | | -from os.path import isfile, abspath |
| 5 | +from os.path import isfile |
6 | 6 | from re import sub |
7 | 7 | import argparse |
8 | 8 | import json |
9 | 9 | import operator |
10 | 10 | import sys |
11 | | -import requests |
12 | | - |
13 | | - |
14 | | -def get_golden(platform, design, api_base_url): |
15 | | - try: |
16 | | - response = requests.get( |
17 | | - api_base_url + f"/golden?platform={platform}&design={design}&variant=base" |
18 | | - ) |
19 | | - |
20 | | - # Check if the request was successful (status code 200) |
21 | | - if response.status_code == 200 and "error" not in response.json(): |
22 | | - # Parse the JSON response |
23 | | - data = response.json() |
24 | | - |
25 | | - return data, None |
26 | | - else: |
27 | | - print("API request failed") |
28 | | - return None, "API request failed" |
29 | | - except Exception as e: |
30 | | - print(f"An error occurred: {str(e)}") |
31 | | - return None, f"An error occurred: {str(e)}" |
32 | | - |
33 | | - |
34 | | -def get_metrics(commitSHA, platform, design, api_base_url): |
35 | | - try: |
36 | | - response = requests.get( |
37 | | - api_base_url |
38 | | - + f"/commit?commitSHA={commitSHA}&platform={platform}&design={design}&variant=base" |
39 | | - ) |
40 | | - |
41 | | - # Check if the request was successful (status code 200) |
42 | | - if response.status_code == 200 and "error" not in response.json(): |
43 | | - # Parse the JSON response |
44 | | - data = response.json() |
45 | | - |
46 | | - return data, None |
47 | | - else: |
48 | | - print("API request failed") |
49 | | - return None, "API request failed" |
50 | | - except Exception as e: |
51 | | - print(f"An error occurred: {str(e)}") |
52 | | - return None, f"An error occurred: {str(e)}" |
53 | 11 |
|
54 | 12 |
|
55 | 13 | def update_rules(designDir, variant, golden_metrics, overwrite, metrics_to_consider): |
|
0 commit comments