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

Add a NERSC status checker. #183

Merged
merged 2 commits into from
Jan 18, 2025
Merged

Add a NERSC status checker. #183

merged 2 commits into from
Jan 18, 2025

Conversation

MrCreosote
Copy link
Member

No description provided.

@MrCreosote MrCreosote requested a review from Tianhao-Gu January 16, 2025 17:26
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 65.21739% with 16 lines in your changes missing coverage. Please review.

Project coverage is 52.04%. Comparing base (e357b47) to head (4a474b6).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
cdmtaskservice/nersc/status.py 65.21% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
+ Coverage   51.79%   52.04%   +0.24%     
==========================================
  Files          35       36       +1     
  Lines        2475     2521      +46     
==========================================
+ Hits         1282     1312      +30     
- Misses       1193     1209      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if ac.status != StatusValue.active:
outages = await self._cli.resources.outages(ac.name)
for o in outages:
if o.status == "Active":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if o.status == "Active":
if o.status == StatusValue.active:

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't actually an enum in the client, although It could be. If it were, though, it'd be a different enum than StatusValue as the values are different - even "Active" has different capitalization

Comment on lines +39 to +41
if self.perlmutter_available and self.dtns_available:
return max(self.perlmutter_available, self.dtns_available)
return self.dtns_available if self.dtns_available else self.perlmutter_available
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if self.perlmutter_available and self.dtns_available:
return max(self.perlmutter_available, self.dtns_available)
return self.dtns_available if self.dtns_available else self.perlmutter_available
return max(self.perlmutter_available or 0, self.dtns_available or 0)

Copy link
Member Author

Choose a reason for hiding this comment

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

The *_available instance variables are datetimes and therefore trying to compare them to ints fails. I thought about using datetime.min instead, but that would require checking for that value and replacing it with None, so it requires using a magic value, which I'm not a fan of, and doesn't make the code all that less complex. So for now I'm leaving it as is, but as a consolation prize I wrote tests for if we want to refactor later.

@MrCreosote MrCreosote merged commit b267cf9 into main Jan 18, 2025
11 checks passed
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.

2 participants