sot / kadi

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

Update_cmds fixes for py3 #139

Closed taldcroft closed 4 years ago

taldcroft commented 4 years ago

Fixes for kadi update_cmds to run correctly on Py3. Also includes minor flake8 fixes. Just one non-trivial fix related to the diffing and a bytes/unicode issue. (str() of a bytestring gives b'blah' not blah.)

Testing

On HEAD (kady) in ska3/flight

ska  # LEGACY ska
cd ~/tmp/kadi-test
python /proj/sot/ska/share/update_cmds.py --start=2015:001 --stop=2015:030
# Creates local cmds.h5 and cmds.pkl for the date range using the Ska2-flight kadi.

On local machine (MacOS) in py3-compat branch

ska3  # Activate ska3 environment
cd ~/git/kadi
git checkout py3-compat
cp ~/git/ska_testr/packages/kadi/write_events_cmds.py write_cmds.py
rm cmds.*
./update_cmds.py --start=2015:001 --stop=2015:030 --mp-dir ~/ska/data/mpcrit1/mplogs
python write_cmds.py  --start=2014:001 --stop=2016:001
# Creates cmds.txt which is a plain-text version of the commands

mkdir cmds-ska2
cd cmds-ska2
scp 'kady:tmp/kadi-test/cmds.*' ./
python ../write_cmds.py --start=2014:001 --stop=2016:001

diff cmds.txt ../cmds.txt
# Compare cmds from local branch to ska2-flight version
#  ** NO DIFF **
taldcroft commented 4 years ago

This is tested (and the testing documented) to my satisfaction, so merging. Not clear yet if this will go as a release or if we should bundle #143 (which is a much bigger change and requires django 2.2).