File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5757from ..brokers ._util import (
5858 DataUnavailable ,
5959)
60+ from ..storage import TimeseriesNotFound
6061
6162if TYPE_CHECKING :
6263 from bidict import bidict
@@ -690,13 +691,18 @@ async def tsdb_backfill(
690691 # but if not then below the remaining history can be lazy
691692 # loaded?
692693 fqme : str = mkt .fqme
693- tsdb_entry : tuple | None = await storage .load (
694- fqme ,
695- timeframe = timeframe ,
696- )
697-
698694 last_tsdb_dt : datetime | None = None
699- if tsdb_entry :
695+ try :
696+ tsdb_entry : tuple | None = await storage .load (
697+ fqme ,
698+ timeframe = timeframe ,
699+ )
700+ except TimeseriesNotFound :
701+ log .warning (
702+ f'No timeseries yet for { fqme } '
703+ )
704+
705+ else :
700706 (
701707 tsdb_history ,
702708 first_tsdb_dt ,
@@ -963,7 +969,8 @@ async def manage_history(
963969 sub_for_broadcasts = False ,
964970
965971 ) as sample_stream :
966- # register 1s and 1m buffers with the global incrementer task
972+ # register 1s and 1m buffers with the global
973+ # incrementer task
967974 log .info (f'Connected to sampler stream: { sample_stream } ' )
968975
969976 for timeframe in [60 , 1 ]:
Original file line number Diff line number Diff line change @@ -139,6 +139,13 @@ async def write_ohlcv(
139139 ...
140140
141141
142+ class TimeseriesNotFound (Exception ):
143+ '''
144+ No timeseries entry can be found for this backend.
145+
146+ '''
147+
148+
142149class StorageConnectionError (ConnectionError ):
143150 '''
144151 Can't connect to the desired tsdb subsys/service.
Original file line number Diff line number Diff line change 1919 call a poor man's tsdb).
2020
2121AKA a `piker`-native file-system native "time series database"
22- without needing an extra process and no standard TSDB features, YET!
22+ without needing an extra process and no standard TSDB features,
23+ YET!
2324
2425'''
2526# TODO: like there's soo much..
6768from piker .data import def_iohlcv_fields
6869from piker .data import ShmArray
6970from piker .log import get_logger
71+ from . import TimeseriesNotFound
7072
7173
7274log = get_logger ('storage.nativedb' )
7375
7476
75- class TimeseriesNotFound (Exception ):
76- '''
77- No timeseries entry can be found for this backend.
78-
79- '''
80-
8177# NOTE: thanks to this SO answer for the below conversion routines
8278# to go from numpy struct-arrays to polars dataframes and back:
8379# https://stackoverflow.com/a/72054819
You can’t perform that action at this time.
0 commit comments