Skip to content

Explicitly request type when using nerc_rates #123

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

Merged
merged 1 commit into from
Apr 30, 2025
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
12 changes: 6 additions & 6 deletions openshift_metrics/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_su_definitions(report_month) -> dict:
su_definitions.setdefault(f"OpenShift {su_name}", {})
for resource_name in resource_names:
su_definitions[f"OpenShift {su_name}"][resource_name] = nerc_data.get_value_at(
f"{resource_name} in {su_name} SU", report_month
f"{resource_name} in {su_name} SU", report_month, Decimal
)
# Some internal SUs that I like to map to when there's insufficient data
su_definitions[invoice.SU_UNKNOWN_GPU] = {"vGPUs": 1, "vCPUs": 8, "RAM": 64*1024}
Expand Down Expand Up @@ -133,11 +133,11 @@ def main():
logger.info("Using nerc rates.")
nerc_data = nerc_rates.load_from_url()
rates = invoice.Rates(
cpu=Decimal(nerc_data.get_value_at("CPU SU Rate", report_month)),
gpu_a100=Decimal(nerc_data.get_value_at("GPUA100 SU Rate", report_month)),
gpu_a100sxm4=Decimal(nerc_data.get_value_at("GPUA100SXM4 SU Rate", report_month)),
gpu_v100=Decimal(nerc_data.get_value_at("GPUV100 SU Rate", report_month)),
gpu_h100=Decimal(nerc_data.get_value_at("GPUH100 SU Rate", report_month)),
cpu=nerc_data.get_value_at("CPU SU Rate", report_month, Decimal),
gpu_a100=nerc_data.get_value_at("GPUA100 SU Rate", report_month, Decimal),
gpu_a100sxm4=nerc_data.get_value_at("GPUA100SXM4 SU Rate", report_month, Decimal),
gpu_v100=nerc_data.get_value_at("GPUV100 SU Rate", report_month, Decimal),
gpu_h100=nerc_data.get_value_at("GPUH100 SU Rate", report_month, Decimal),
)
else:
rates = invoice.Rates(
Expand Down