Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 45 failed srcintegrity teststest allpytestallcatalogstest non zero cost #46

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/catalogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
schedule:
- cron: '0 1 * * *' # 01:00 UTC every day

env:
PIP_DISABLE_PIP_VERSION_CHECK: on
PIP_DEFAULT_TIMEOUT: 10
PIP_PROGRESS_BAR: off

jobs:
catalog-aws:
name: Collect AWS catalog
Expand Down
6 changes: 5 additions & 1 deletion src/gpuhunt/providers/azure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import math
import os
import re
import time
Expand Down Expand Up @@ -146,10 +147,13 @@ def get(
continue
if not item["armSkuName"]:
continue
price = float(item["retailPrice"])
if math.isclose(price, 0):
continue
offer = RawCatalogItem(
instance_name=item["armSkuName"],
location=item["armRegionName"],
price=item["retailPrice"],
price=price,
spot="Spot" in item["meterName"],
cpu=None,
memory=None,
Expand Down
23 changes: 13 additions & 10 deletions src/integrity_tests/test_all.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import csv
import os
from pathlib import Path
from typing import List

import pytest

files = sorted(Path(os.environ["CATALOG_DIR"]).glob("*.csv"))

@pytest.fixture
def catalog_files(catalog_dir: Path) -> List[Path]:
return list(catalog_dir.glob("*.csv"))

def catalog_name(catalog) -> str:
return catalog.name


class TestAllCatalogs:
def test_non_zero_cost(self, catalog_files: List[Path]):
for file in catalog_files:
with open(file, "r") as f:
reader = csv.DictReader(f)
prices = [float(row["price"]) for row in reader]
assert 0 not in prices
@pytest.fixture(params=files, ids=catalog_name)
def catalog(self, request):
yield request.param

def test_non_zero_cost(self, catalog):
reader = csv.DictReader(catalog.open())
for row in reader:
assert float(row["price"]) != pytest.approx(0), str(row)
Loading