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 planned maintenance #194

Merged
merged 93 commits into from
Jun 13, 2024
Merged

Add planned maintenance #194

merged 93 commits into from
Jun 13, 2024

Conversation

stveit
Copy link
Contributor

@stveit stveit commented Mar 24, 2024

Fixes #61, API still missing (tracked by #101). That will be separate PR

Copy link

github-actions bot commented Mar 24, 2024

Test results

    3 files      3 suites   51s ⏱️
  380 tests   380 ✅ 0 💤 0 ❌
1 140 runs  1 138 ✅ 2 💤 0 ❌

Results for commit db797f8.

♻️ This comment has been updated with latest results.

@stveit stveit force-pushed the feature/planned-maintenance branch from e617895 to ca0a568 Compare March 24, 2024 05:46
Copy link

codecov bot commented Mar 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.99%. Comparing base (5b7f5c0) to head (db797f8).
Report is 17 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
+ Coverage   98.98%   98.99%   +0.01%     
==========================================
  Files          50       50              
  Lines        6565     6740     +175     
==========================================
+ Hits         6498     6672     +174     
- Misses         67       68       +1     

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

src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
@johannaengland
Copy link
Contributor

I just checked in Zino1.0 and found that get_started_planned_maintenances will actually not check if the pms have ended before the current time. I think this might be something to discuss, even though it is quite an edge case, since we don't think any pms will have started after the last run, but ended before the time the function is called.

@stveit
Copy link
Contributor Author

stveit commented Apr 2, 2024

I just checked in Zino1.0 and found that get_started_planned_maintenances will actually not check if the pms have ended before the current time. I think this might be something to discuss, even though it is quite an edge case, since we don't think any pms will have started after the last run, but ended before the time the function is called.

yeah noticed this too, seems like an oversight but I guess no planned maintenance has ever been shorter than whatever interval the PM stuff runs at

@johannaengland
Copy link
Contributor

I just checked in Zino1.0 and found that get_started_planned_maintenances will actually not check if the pms have ended before the current time. I think this might be something to discuss, even though it is quite an edge case, since we don't think any pms will have started after the last run, but ended before the time the function is called.

yeah noticed this too, seems like an oversight but I guess no planned maintenance has ever been shorter than whatever interval the PM stuff runs at

Yes, that would make very little sense to have a PM shorter than one minute.
But I still think we can add that check, that makes testing easier and seems like good practice to me.

@stveit stveit force-pushed the feature/planned-maintenance branch 2 times, most recently from bb41ab8 to c7ada43 Compare April 5, 2024 09:29
Copy link

sonarcloud bot commented Apr 5, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@johannaengland johannaengland changed the title Add planned maintenace Add planned maintenance Apr 5, 2024
@stveit
Copy link
Contributor Author

stveit commented Apr 5, 2024

#207

Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

I don't know the original PM code intimately, so I'm just going by intuition on some of the functionality.

All in all, pretty comprehensive and nearly complete, but I'm left with a feeling that perhaps more of the functionality of the PlannedMaintenances class could be moved to the PlannedMaintenance class, especially much of the things that just take a single PlannedMaintenance object and doesn't really touch the internal state of the PlannedMaintenances object itself.

Another idea could be to split PlannedMaintance class could even be split into subclasses, one for each type ("portstate", "device"). The event matching or generating methods could then be subclass specific.

Maybe an IRL pow-wow would be better here :)

src/zino/zino.py Outdated Show resolved Hide resolved
src/zino/statemodels.py Outdated Show resolved Hide resolved
src/zino/statemodels.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
src/zino/planned_maintenance.py Outdated Show resolved Hide resolved
@stveit stveit force-pushed the feature/planned-maintenance branch 4 times, most recently from 3d465f7 to b980219 Compare May 29, 2024 10:15
@stveit
Copy link
Contributor Author

stveit commented May 30, 2024

#234 #202

@stveit
Copy link
Contributor Author

stveit commented May 30, 2024

#236

@stveit stveit marked this pull request as ready for review May 30, 2024 09:30
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

This is really turning out nice!

Cannot finish without some nit-picks, though! :-)

src/zino/statemodels.py Outdated Show resolved Hide resolved
src/zino/statemodels.py Outdated Show resolved Hide resolved
src/zino/statemodels.py Outdated Show resolved Hide resolved
src/zino/statemodels.py Outdated Show resolved Hide resolved
src/zino/statemodels.py Outdated Show resolved Hide resolved
tests/planned_maintenance_test.py Outdated Show resolved Hide resolved
tests/planned_maintenance_test.py Outdated Show resolved Hide resolved
tests/planned_maintenance_test.py Outdated Show resolved Hide resolved
tests/planned_maintenance_test.py Outdated Show resolved Hide resolved
tests/planned_maintenance_test.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented May 31, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 11 0 0.66s
✅ PYTHON isort 11 0 0.23s
✅ PYTHON ruff 11 0 0.03s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@stveit stveit force-pushed the feature/planned-maintenance branch from c9df563 to db797f8 Compare June 13, 2024 07:26
Copy link

sonarcloud bot commented Jun 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@stveit stveit merged commit bbccc90 into master Jun 13, 2024
11 checks passed
@stveit stveit deleted the feature/planned-maintenance branch June 13, 2024 07:32
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 planned maintenance (PM) calendar to Zino backend state
3 participants