sot / kadi

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

failure when deriving states from backstop commands on shiny #189

Closed jzuhone closed 3 years ago

jzuhone commented 3 years ago

the following script (run using shiny):

from kadi import commands
from kadi.commands import states

# Get commands from JUN2720 from backstop
backstop_file = "/data/acis/LoadReviews/2020/JUL2720/oflsb/CR208_1806.backstop"
cmds = commands.get_cmds_from_backstop(backstop_file)

t = states.get_states(cmds=cmds, merge_identical=True)

produces the following traceback:

Traceback (most recent call last):
  File "test_bs_cmds.py", line 8, in <module>
    t = states.get_states(cmds=cmds, merge_identical=True)
  File "/Users/jzuhone/miniconda3/envs/ska-shiny/lib/python3.8/site-packages/kadi/commands/states.py", line 1253, in get_states
    transitions = get_transitions_list(cmds, state_keys, start, stop, continuity)
  File "/Users/jzuhone/miniconda3/envs/ska-shiny/lib/python3.8/site-packages/kadi/commands/states.py", line 1128, in get_transitions_list
    transition_class.set_transitions(transitions_dict, cmds, start, stop)
  File "/Users/jzuhone/miniconda3/envs/ska-shiny/lib/python3.8/site-packages/kadi/commands/states.py", line 290, in set_transitions
    transitions_dict[date][name] = params[param_key]
KeyError: 'id'

Not sure if this is a bug or if I did something incorrect.

jzuhone commented 3 years ago

ping @taldcroft

jzuhone commented 3 years ago

An automatic script running on non-Shiny kadi has been failing today with the same error, so it looks like perhaps a database file is corrupted.

jeanconn commented 3 years ago

Thanks John, is the script doing something similar?

jeanconn commented 3 years ago

I can confirm that test_continuity_far_future looks to also be failing on kadi 5.2.0 in ska3-flight.

taldcroft commented 3 years ago

Grr. I understand now. In an effort to make the cmds.h5 as small as possible I made an index field that identifies unique command args be 2 bytes, but the number of unique commands has just gone over 65536. Stupid over-optimization. I may be able to fix this soon, but I need to look a bit closer.