sot / kadi

Chandra commands and events
https://sot.github.io/kadi
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Add email notifications for validation violations #302

Closed taldcroft closed 7 months ago

taldcroft commented 7 months ago

Description

This PR adds email notification to aca@cfa.harvard.edu for violations.

As part of this I did some refactoring to use smaller, more separable, processing functions. The first step was moving the mail validation script processing function from validate.py (implements validator functionality) to validate_states.py (does the processing to produce a report page).

Closes #271

Required dependencies

This requires:

Interface impacts

Email alert notification for any kadi command states validation violations.

Testing

Unit tests

kadi/commands/tests/test_commands.py .............................................................. [ 28%] ............. [ 34%] kadi/commands/tests/test_states.py ......................x......................................... [ 63%] ....x....................... [ 76%] kadi/commands/tests/test_validate.py .................... [ 85%] kadi/tests/test_events.py .......... [ 89%] kadi/tests/test_occweb.py ...................... [100%]

================================ 217 passed, 2 xfailed in 91.58s (0:01:31) ================================


Independent check of unit tests by [REVIEWER NAME]
- [ ] [PLATFORM]:

### Functional tests
<!-- Describe and document results of any functional tests, otherwise leave the text below -->
On kady in ska3 2023.7, with the two git directories checked out at master corresponding to the versions shown above. The off_nom_roll violations are found because this processing does not include the improvements to ska_sun and chandra_aca.planets.

Output: https://icxc.cfa.harvard.edu/aspect/test_review_outputs/kadi/pr302/

env PYTHONPATH=/home/aldcroft/git/Quaternion:/home/aldcroft/git/ska_helpers \ python -m kadi.scripts.validate_states --email taldcroft@cfa.harvard.edu ... 2023-12-03 07:06:14,274 get_plot_html: Creating HTML for state sun_pos_mon 2023-12-03 07:06:14,290 main: kadi validate_states processing found state violation(s):

name             start                  stop        

off_nom_roll 2023:326:07:37:24.629 2023:326:08:31:44.128 off_nom_roll 2023:328:23:57:25.428 2023:329:00:06:25.603 off_nom_roll 2023:329:00:38:51.053 2023:329:00:50:16.778 off_nom_roll 2023:329:01:09:07.353 2023:329:04:49:08.328 off_nom_roll 2023:335:13:30:00.478 2023:335:13:31:30.678 pcad_mode 2023:326:20:05:54.867 2023:326:20:07:23.017

See:https://cxc.harvard.edu/mta/ASPECT/validate_states/

2023-12-03 07:06:14,327 send_mail: Sent mail to ['taldcroft@cfa.harvard.edu']


Email:
<img width="447" alt="image" src="https://github.com/sot/kadi/assets/348089/040f8989-65f1-4399-849a-0f6f63879a48">
jeanconn commented 7 months ago

Though I should have asked before I approved -- why does this need ska_helpers 0.13.0?

taldcroft commented 7 months ago

Though I should have asked before I approved -- why does this need ska_helpers 0.13.0?

I think it was the coerce_types thingy.

jeanconn commented 7 months ago

Makes sense but is in 0.12.0 (0.13.0 just has a test update so I was trying to figure out if if you were calling out a different package or different release).