Skip to content

Add new columns for daily report#171

Merged
naved001 merged 6 commits intoCCI-MOC:mainfrom
naved001:columns-for-daily-report
Dec 3, 2025
Merged

Add new columns for daily report#171
naved001 merged 6 commits intoCCI-MOC:mainfrom
naved001:columns-for-daily-report

Conversation

@naved001
Copy link
Collaborator

@naved001 naved001 commented Nov 24, 2025

A bunch of tests will fail, but I want to make sure people are happy with the way things are organized before I update the tests.

The first commit adds the new feature, the 2nd commit refactors things around it.

Closes #166
Related nerc-project/operations#1307

* Remove attributes that we get from coldfront from the invoice. Still
  keep the CSV output consistent though.
* Hold report metadata in a dataclass and pass that around to the helper
  functions to keep things better contained.
@knikolla
Copy link
Contributor

Seems good to me.

Also update the headers for the report by classes, not that we
specifically need it for that report, but it's just good to keep it
consistent.
@naved001 naved001 force-pushed the columns-for-daily-report branch from 99960d1 to ccb5c35 Compare December 2, 2025 15:51
Also use a single timestamp for current_time throughout the report.
@naved001 naved001 force-pushed the columns-for-daily-report branch from 954b1f1 to 02f2a23 Compare December 2, 2025 16:55
Copy link
Collaborator

@QuanMPhm QuanMPhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two small comments

Comment on lines 222 to 223
if report_start_date.month != report_end_date.month:
logger.warning("The report spans multiple months")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this if clause be removed, since if the extra string is appended, calling nerc_rates with it will raise an date parsing error?

Copy link
Collaborator Author

@naved001 naved001 Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QuanMPhm I am not sure I follow why this would cause an error. What extra string are you talking about?

Oh, I see it now. Good point. I will just remove this clause, it's not strictly necessary and now the new columns will indicate the report start and report end anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QuanMPhm this has been addressed.

su_definitions=su_definitions,
cluster_name=cluster_name,
ignore_hours=ignore_hours,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a suggestion for this PR, but for a future refactoring if the time ever comes to it.

I think while we're at it refactoring, you can put condensed_metrics_dict, invoice_rates, and a few other arguments into ReportMetadata, or into named more fittingly (I don't know what's a better name :P). The three functions to write the different invoices could probably be refactored too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have a draft PR that I'll get back to fixing.

@QuanMPhm
Copy link
Collaborator

QuanMPhm commented Dec 3, 2025

@naved001 Do you also plan to changing the frequency of the produce-report-cronjob.yaml to daily instead of 0 13 1 * *?

The new columns will indicate the report start and end date, so it's not
strictly necessary to log a warning anymore. Futhermore, since it
modified the report_month string, it'll break the call the to
get_su_definitions down the line. I could just move that call to it up,
but this warning isn't that necessary anyway.
@naved001
Copy link
Collaborator Author

naved001 commented Dec 3, 2025

@QuanMPhm The cronjobs that are actually deployed are already up to date, I'll push those to the repository in a different PR.

@naved001 naved001 merged commit c71f620 into CCI-MOC:main Dec 3, 2025
3 checks passed
@naved001 naved001 deleted the columns-for-daily-report branch December 3, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add columns that indicate the period the report is for.

3 participants