Skip to content

Commit

Permalink
Merge pull request #212 from lsst-ts/tickets/DM-46515
Browse files Browse the repository at this point in the history
DM-46515: Fix historical data not stored properly
  • Loading branch information
ugyballoons authored Sep 26, 2024
2 parents 4ae3206 + ded8674 commit 06ff886
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 6 additions & 8 deletions python/lsst/ts/rubintv/background/historicaldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,18 @@ async def filter_convert_store_objects(
self._nr_metadata[locname] = await objects_to_ngt_report_data(n_report_objs)
async for events_batch in objects_to_events(event_objs):
await self.store_events(events_batch, locname)
await self.compress_events()
self._temp_events = {}
await self.compress_events()
self._temp_events = {}

async def compress_events(self) -> None:
t = time()
for storage_key, events in self._temp_events.items():
compressed = zlib.compress(pickle.dumps(events))
self._events[storage_key] = compressed
dur = time() - t
logger.info("Compression took:", storage_key=storage_key, dur=dur)
if storage_key in self._events:
self._events[storage_key] += compressed
else:
self._events[storage_key] = compressed

async def store_events(self, events: list[Event], locname: str) -> None:
logger.info("starting store_events")
for event in events:
storage_key = f"{locname}/{event.camera_name}"
if storage_key not in self._temp_events:
Expand All @@ -183,7 +182,6 @@ async def store_events(self, events: list[Event], locname: str) -> None:
self._calendar[loc_cam][year][month] = {}
if self._calendar[loc_cam][year][month].get(day, 0) <= seq_num:
self._calendar[loc_cam][year][month][day] = seq_num
logger.info("ending store_events")

async def download_and_store_metadata(
self, locname: str, metadata_objs: list[dict[str, str]]
Expand Down
6 changes: 4 additions & 2 deletions src/sass/colours.sass
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ header
&:hover
text-decoration: none
&.obs
background: #858383
font-weight: bold
background: #fff
color: #000
&:hover
background: #887166 !important
background: #d8d8d8 !important

.allsky
.day
Expand Down

0 comments on commit 06ff886

Please sign in to comment.