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

Change cudo to online provider #51

Merged
merged 9 commits into from
Mar 14, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix Type Error in Cudo
  • Loading branch information
Bihan Rana authored and Bihan Rana committed Mar 13, 2024
commit 361885e921f000d8e1315a7eca1a7ed24aeed1da
10 changes: 4 additions & 6 deletions src/gpuhunt/providers/cudo.py
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ def fetch_offers(
return list(chain.from_iterable(offers))

@staticmethod
def list_vm_machine_types() -> list[dict]:
def list_vm_machine_types():
resp = requests.request(
method="GET",
url=f"{API_URL}/vms/machine-types-2",
@@ -60,9 +60,7 @@ def list_vm_machine_types() -> list[dict]:
resp.raise_for_status()

@staticmethod
def optimize_offers(
machine_types: list[dict], q: QueryFilter, balance_resource
) -> List[RawCatalogItem]:
def optimize_offers(machine_types, q: QueryFilter, balance_resource) -> List[RawCatalogItem]:
offers = []
if any(
condition is not None
@@ -136,7 +134,7 @@ def get_raw_catalog(machine_type, spec):
return raw


def optimize_offers_with_gpu(q: QueryFilter, machine_type, balance_resources) -> List[dict]:
def optimize_offers_with_gpu(q: QueryFilter, machine_type, balance_resources):
# Generate ranges for CPU, GPU, and memory based on the specified minimums, maximums, and available resources
cpu_range = get_cpu_range(q.min_cpu, q.max_cpu, machine_type["maxVcpuFree"])
gpu_range = get_gpu_range(q.min_gpu_count, q.max_gpu_count, machine_type["maxGpuFree"])
@@ -200,7 +198,7 @@ def optimize_offers_with_gpu(q: QueryFilter, machine_type, balance_resources) ->
return unbalanced_specs


def optimize_offers_no_gpu(q: QueryFilter, machine_type, balance_resource) -> List[dict]:
def optimize_offers_no_gpu(q: QueryFilter, machine_type, balance_resource):
# Generate ranges for CPU, memory based on the specified minimums, maximums, and available resources
cpu_range = get_cpu_range(q.min_cpu, q.max_cpu, machine_type["maxVcpuFree"])
memory_range = get_memory_range(q.min_memory, q.max_memory, machine_type["maxMemoryGibFree"])