sot / kadi

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

Validate kadi states #261

Closed taldcroft closed 1 year ago

taldcroft commented 1 year ago

Description

This is the modern Py3 version of validate_states. Instead of updating that project and making a new Ska3 package, this PR makes a new sub-package of kadi (with a corresponding app) to handle state validation.

This requires https://github.com/sot/eng_archive/pull/242.

Known issues / To do

Optional

Interface impacts

This will supersede the Py2 validate_states app.

Testing

Unit tests

Independent check of unit tests by Jean. I ran with https://github.com/sot/eng_archive/pull/242, https://github.com/sot/maude/pull/44, https://github.com/sot/cxotime/pull/31 in my path.

Functional tests

Run over full 2022:293 IU-reset and Safe mode

python -m kadi.scripts.validate_states --days=7 --stop=2022:297

This gives the expected results.

Run within 2022:293 IU-reset and Safe mode (at day 295:0000z)

This creates a data gap corresponding to being in a real-time comm after an 8-hour gap.

env CHETA_FETCH_DATA_GAP="--exclude=*ephem?_* --start=2022:294:15:00:00 --stop=2022:294:23:00:00" \
python -m kadi.scripts.validate_states --days=3 --stop=2022:295

This gives the expected results.

javierggt commented 1 year ago

This is possible with plotly figures:

json.dumps(fig, indent=2)

so in principle one can always recreate the figure from the json. That means the web app has the choice of rendering the html in the server or sending the json and rendering in the browser.

One option for a web page could be to request each validation plot separately in json and load them as they are done, but it might not be a good idea because there might be repeated calls to maude spread over several python instances.

taldcroft commented 1 year ago

I noticed that the setup.py still lists all the templates, so I just want to point out that those templates were removed. Currently, the only templates in kadi are the ones added by this PR.

Fixed.

taldcroft commented 1 year ago

If this is implemented in the kadi web server, most likely the templates will not be used, because we will want to use the kadi style. I suppose it is ok to leave them here, because this is currently a standalone application.

Yes, we can cross that bridge later with the app. Likewise the interesting idea about returning the validation plot as JSON in order to have a more responsive app.