sot / kadi

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

Problem creating entire starcats.db cache file in one session #252

Closed taldcroft closed 1 year ago

taldcroft commented 1 year ago

As noted in https://github.com/sot/agasc/pull/135:

In [1]: from agasc.supplement.magnitudes import star_obs_catalogs
   ...: 

In [2]: stars_obs_v2 = star_obs_catalogs.get_star_observations()
   ...: 

HASH: Out of overflow pages.  Increase page size
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-2-b3fe61c90950> in <module>
----> 1 stars_obs_v2 = star_obs_catalogs.get_star_observations()

~/git/agasc/agasc/supplement/magnitudes/star_obs_catalogs.py in get_star_observations(start, stop, obsid)
     23 
     24     with commands.conf.set_temp('commands_version', '2'):
---> 25         catalogs = commands.get_starcats(start=start, stop=stop, obsid=obsid)
     26         observations = Table(commands.get_observations(start=start, stop=stop, obsid=obsid))
     27         for cat in catalogs:

~/git/kadi/kadi/commands/observations.py in get_starcats(start, stop, obsid, scenario, cmds, as_dict)
    365                     starcat = starcat_dict
    366 
--> 367                 starcats_db[db_key] = starcat_dict
    368 
    369             starcats.append(starcat)

~/miniconda3/envs/ska3/lib/python3.8/shelve.py in __setitem__(self, key, value)
    123         p = Pickler(f, self._protocol)
    124         p.dump(value)
--> 125         self.dict[key.encode(self.keyencoding)] = f.getvalue()
    126 
    127     def __delitem__(self, key):

error: cannot add item to database

I spent a good while doing a deep dive into this problem, which is slow because it only shows up after a couple minutes of churning.

So this is in a somewhat unhappy place. The workaround is incrementally building up the starcats.db cache file in 5 year chunks. Eventually I'll do something better.

taldcroft commented 1 year ago

Closed by #253. I confirm that getting every star catalog in the mission starting from scratch (no starcats_cache.db file) does not crash.