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

adds recommended memory and cpu #56

Merged
merged 1 commit into from
Aug 20, 2024
Merged
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
16 changes: 12 additions & 4 deletions omics/cli/run_analyzer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_static_storage_gib(capacity=None):


def get_instance(cpus, mem):
"""Return smallest matching instance type"""
"""Return a tuple of smallest matching instance type (str), cpus in that type (int), GiB memory of that type (int)"""
sizes = {
"": 2,
"x": 4,
Expand All @@ -112,7 +112,7 @@ def get_instance(cpus, mem):
mcount = ccount * families[fam]
if mcount < mem:
continue
return f"omics.{fam}.{size}large"
return (f"omics.{fam}.{size}large", ccount, mcount)
return ""


Expand Down Expand Up @@ -364,8 +364,14 @@ def add_metrics(res, resources, pricing):
if price:
metrics["estimatedUSD"] = price
if cpus_max and mem_max and not gpus_res:
itype = get_instance(cpus_max, mem_max)
metrics["omicsInstanceTypeMinimum"] = itype
(itype, cpus, mem) = get_instance(cpus_max, mem_max)
metrics["omicsInstanceTypeMinimum"] = itype
metrics["recommendedCpus"] = cpus
metrics["recommendedMemoryGiB"] = mem
else:
metrics["omicsInstanceTypeMinimum"] = itype
metrics["recommendedCpus"] = cpus_res
metrics["recommendedMemoryGiB"] = mem_res
price = get_pricing(pricing, itype, region, running / SECS_PER_HOUR)
if price:
metrics["minimumUSD"] = price
Expand Down Expand Up @@ -463,6 +469,8 @@ def tocsv(val):
"memory",
"omicsInstanceTypeReserved",
"omicsInstanceTypeMinimum",
"recommendedCpus",
"recommendedMemoryGiB",
"estimatedUSD",
"minimumUSD",
"cpuUtilizationRatio",
Expand Down
Loading