sot / chandra_cmd_states

Interface for creation and maintenance of the Chandra commanded states database.
https://sot.github.io/cmd_states
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Fix add_nonload_cmds to output correct representations of cmd args #35

Closed taldcroft closed 6 years ago

taldcroft commented 6 years ago

As documented in #8, there is problem when adding non-load commands that have string-valued arguments. This fixes that, and also fixes add_nonload_cmds.py which has entries that are affected by this bug.

Testing

Regression test

# Setup and process
$ rm db_base.db3
$ ./make_new_tl_ls.py --start 2016:350
$ ./make_cmd_tables.py
$ ./nonload_cmds_archive.py
$ ./update_cmd_states.py --datestart=2016:350

$ ./add_nonload_cmds.py --check
Connecting to db: dbi=sqlite server=db_base.db3
Most recent non-load commands
Date                   CMD          TLMSID     MSID
2017:254:20:00:40.000  MP_OBSID     None       None     ID=65529
2017:254:07:52:56.960  ACISPKT      WSPOW00000 None
2017:254:07:52:46.710  ACISPKT      AA00000000 None
2017:254:07:52:45.685  ACISPKT      AA00000000 None
2017:254:07:51:40.025  SIMTRANS     None       None     POS=-99616
2017:251:19:45:13.000  ACISPKT      XTZ0000005 None
2017:251:19:45:12.000  ACISPKT      WT00C62014 None
2017:251:19:45:11.000  ACISPKT      WSPOW08E1E None
2017:251:19:45:10.000  ACISPKT      WSVIDALLDN None
2017:251:19:45:00.000  MP_OBSID     None       None     ID=62661

$ ./add_nonload_cmds.py --check --server=/proj/sot/ska/data/cmd_states/cmd_states.db3
Connecting to db: dbi=sqlite server=/proj/sot/ska/data/cmd_states/cmd_states.db3
Most recent non-load commands
Date                   CMD          TLMSID     MSID
2017:254:20:00:40.000  MP_OBSID     None       None     ID=65529
2017:254:07:52:56.960  ACISPKT      WSPOW00000 None
2017:254:07:52:46.710  ACISPKT      AA00000000 None
2017:254:07:52:45.685  ACISPKT      AA00000000 None
2017:254:07:51:40.025  SIMTRANS     None       None     POS=-99616
2017:251:19:45:13.000  ACISPKT      XTZ0000005 None
2017:251:19:45:12.000  ACISPKT      WT00C62014 None
2017:251:19:45:11.000  ACISPKT      WSPOW08E1E None
2017:251:19:45:10.000  ACISPKT      WSVIDALLDN None
2017:251:19:45:00.000  MP_OBSID     None       None     ID=62661

Functional test

$ ./add_nonload_cmds.py --cmd-set=acis WSVIDALLDN
$ ./add_nonload_cmds.py --cmd-set=obsid 60002
$ ./add_nonload_cmds.py --check
Most recent non-load commands
Date                   CMD          TLMSID     MSID
2018:001:14:41:05.582  MP_OBSID     None       None     ID=60002
2018:001:14:40:41.075  ACISPKT      WSVIDALLDN None
2017:254:20:00:40.000  MP_OBSID     None       None     ID=65529
2017:254:07:52:56.960  ACISPKT      WSPOW00000 None
2017:254:07:52:46.710  ACISPKT      AA00000000 None
2017:254:07:52:45.685  ACISPKT      AA00000000 None
2017:254:07:51:40.025  SIMTRANS     None       None     POS=-99616
2017:251:19:45:13.000  ACISPKT      XTZ0000005 None
2017:251:19:45:12.000  ACISPKT      WT00C62014 None
2017:251:19:45:11.000  ACISPKT      WSPOW08E1E None

$ git diff nonload_cmds_archive.py

+ # Autogenerated by add_nonload_cmds.py at Mon Jan  1 09:40:41 2018
+ # date=2018:001:14:40:41.075 cmd_set=acis args=WSVIDALLDN
+ cmds = generate_cmds('2018:001:14:40:41.075', cmd_set('acis', 'WSVIDALLDN'))
+ cmd_states.insert_cmds_db(cmds, None, db)
+
+ # Autogenerated by add_nonload_cmds.py at Mon Jan  1 09:41:05 2018
+ # date=2018:001:14:41:05.582 cmd_set=obsid args=60002
+ cmds = generate_cmds('2018:001:14:41:05.582', cmd_set('obsid', 60002))
+ cmd_states.insert_cmds_db(cmds, None, db)

Fixes #8