From 5958acebe19199ab30ffc2f285bf70d92c7bf895 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 7 Mar 2023 15:35:07 -0500 Subject: [PATCH] Add (commented) draft 1min OHLC time index logging For the purposes of eventually trying to resolve last-step indexing synchronization (an intermittent but still existing) issue(s) that can happen due to races during history frame query and shm writing during startup. In fact, here we drop all `hist_viz` info queries from the main display loop for now anticipating that this code will either be removed or improved later. --- piker/ui/_display.py | 46 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/piker/ui/_display.py b/piker/ui/_display.py index 3b779edf..1ff9c4dc 100644 --- a/piker/ui/_display.py +++ b/piker/ui/_display.py @@ -32,6 +32,7 @@ from typing import ( import tractor import trio import pyqtgraph as pg +# import pendulum from msgspec import field @@ -187,8 +188,6 @@ class DisplayState(Struct): 'i_last': 0, 'i_last_append': 0, 'last_mx_vlm': 0, - # 'last_mx': 0, - # 'last_mn': 0, } ) hist_vars: dict[str, Any] = field( @@ -196,8 +195,6 @@ class DisplayState(Struct): 'i_last': 0, 'i_last_append': 0, 'last_mx_vlm': 0, - # 'last_mx': 0, - # 'last_mn': 0, } ) @@ -773,20 +770,33 @@ def graphics_update_cycle( ) profiler('main vb y-autorange') - # SLOW CHART y-auto-range resize case - ( - _, - hist_liv, - _, - _, - _, - _, - _, - ) = hist_viz.incr_info( - ds=ds, - is_1m=True, - ) - profiler('hist `Viz.incr_info()`') + # SLOW CHART y-auto-range resize casd + # (NOTE: still is still inside the y-range + # guard block above!) + # ( + # _, + # hist_liv, + # _, + # _, + # _, + # _, + # _, + # ) = hist_viz.incr_info( + # ds=ds, + # is_1m=True, + # ) + + # if hist_liv: + # times = hist_viz.shm.array['time'] + # last_t = times[-1] + # dt = pendulum.from_timestamp(last_t) + # log.info( + # f'{hist_viz.name} TIMESTEP:' + # f'epoch: {last_t}\n' + # f'datetime: {dt}\n' + # ) + + # profiler('hist `Viz.incr_info()`') # hist_chart = ds.hist_chart # if (