simonsobs / sisock

Sisock ('saɪsɒk): streaming of Simons Obs. data over websockets for quicklook
Other
2 stars 0 forks source link

Create downsampling component #37

Open BrianJKoopman opened 5 years ago

BrianJKoopman commented 5 years ago

Reading many files from disk in their entirety is slow. As discussed in #22 we should write some downsampled data to disk and record their locations in the SQL database. When a user queries for data we should return the 'best' resolution for their time range that results in a quick response while still representing the data well.

ahincks commented 5 years ago

Is this a job for sisock or should it be the job for another package?

If it is the job of sisock, then perhaps each data server should be responsible for creating these files for itself? What do you think?

ahincks commented 5 years ago

Having thought some more about Issue #29 and having worked at installing and understanding the HERA Librarian in some more detail, here's what I propose. It is, I believed, inspired by @mhasself's notion of "adiabatic" changes to code, in that it remains pretty backward compatible with what sisock, Librarian and so3g are currently doing.

First, create a stand-alone service (with its own repository), provisionally named here so_hk_watchdog, that does the following:

The so_hk_watchdog would run independently of sisock and the Librarian. (Of course, we could bundle it up with them with a single docker-compose if this seemed like a good way to go.)

Then, modify so3g.hk.getdata so that the HKArchive class is optionally able to access the DB populated by the watchdog. Based on the stride of data requested, it would know how to find the correct downsampled file and how to read it.

Then, create a new data source component in sisock that interfaces with so3g.hk.getdata. That is, the solution to Issue #29 is not to modify g3_reader—we can keep that component in case people need a quick 'n' dirty way to display their HK data on a new install.