Skip to content

Commit ba84a8a

Browse files
committed
GPU_A100_RATE and the SU/RESOURCE lists are removed from config.
The USE_NERC_RATES None check is gone since it’s always a bool. The multi‑month block no longer changes report_month. The outage call now passes date strings to match the function.
1 parent 43098ff commit ba84a8a

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

openshift_metrics/config.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,16 @@
1616
S3_METRICS_BUCKET = os.getenv("S3_METRICS_BUCKET", "openshift_metrics")
1717

1818
# Billing Configuration
19-
# Service Unit Names for Rate Lookup from nerc-rates
20-
SU_NAMES = ["GPUV100", "GPUA100", "GPUA100SXM4", "GPUH100", "CPU"]
21-
RESOURCE_NAMES = ["vCPUs", "RAM", "GPUs"]
2219

2320
# Rate Configuration
24-
USE_NERC_RATES_ENV = os.getenv("USE_NERC_RATES")
25-
USE_NERC_RATES = USE_NERC_RATES_ENV.lower() == "true" if USE_NERC_RATES_ENV else None
26-
21+
USE_NERC_RATES = os.getenv("USE_NERC_RATES", "false").lower() == "true"
2722
# Individual rates (used when USE_NERC_RATES=false)
2823
RATE_CPU_SU = os.getenv("RATE_CPU_SU")
2924
RATE_GPU_V100_SU = os.getenv("RATE_GPU_V100_SU")
3025
RATE_GPU_A100SXM4_SU = os.getenv("RATE_GPU_A100SXM4_SU")
3126
RATE_GPU_A100_SU = os.getenv("RATE_GPU_A100_SU")
3227
RATE_GPU_H100_SU = os.getenv("RATE_GPU_H100_SU")
3328

34-
# Legacy rate (for backward compatibility)
35-
GPU_A100_RATE = os.getenv("GPU_A100_RATE")
3629

3730
# Prometheus Query Configuration
3831
PROM_QUERY_INTERVAL_MINUTES = int(os.getenv("PROM_QUERY_INTERVAL_MINUTES", 15))

openshift_metrics/merge.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ def main():
164164
datetime.strptime(report_start_date, "%Y-%m-%d"), "%Y-%m"
165165
)
166166

167-
if USE_NERC_RATES is None:
168-
raise ValueError(
169-
"USE_NERC_RATES environment variable must be set to 'true' or 'false'"
170-
)
171167

172168
if USE_NERC_RATES:
173169
logger.info("Using nerc rates for rates and outages")
@@ -182,10 +178,8 @@ def main():
182178
gpu_h100=rates_data.get_value_at("GPUH100 SU Rate", report_month, Decimal),
183179
)
184180
outage_data = outages.load_from_url()
185-
report_start_date_dt = datetime.strptime(report_start_date, "%Y-%m-%d")
186-
report_end_date_dt = datetime.strptime(report_end_date, "%Y-%m-%d")
187181
ignore_hours = outage_data.get_outages_during(
188-
report_start_date_dt, report_end_date_dt, cluster_name
182+
report_start_date, report_end_date, cluster_name
189183
)
190184
else:
191185
if RATE_CPU_SU is None:
@@ -236,11 +230,6 @@ def main():
236230

237231
if report_start_date_dt.month != report_end_date_dt.month:
238232
logger.warning("The report spans multiple months")
239-
report_month += " to " + datetime.strftime(report_end_date_dt, "%Y-%m")
240-
241-
logger.info(
242-
f"Generating report from {report_start_date_dt} to {report_end_date_dt + timedelta(days=1)} for {cluster_name}"
243-
)
244233

245234
report_start_date = report_start_date_dt
246235
report_end_date = report_end_date_dt

0 commit comments

Comments
 (0)