From 246d07021ec8ceb7aa4cde98f5462d5726648f35 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 24 Jan 2023 18:45:35 -0500 Subject: [PATCH] Drop old loop and wait on fsp engine tasks startups --- piker/ui/_fsp.py | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/piker/ui/_fsp.py b/piker/ui/_fsp.py index c546ec96..9f1eec65 100644 --- a/piker/ui/_fsp.py +++ b/piker/ui/_fsp.py @@ -608,6 +608,7 @@ async def open_vlm_displays( linked: LinkedSplits, flume: Flume, dvlm: bool = True, + loglevel: str = 'info', task_status: TaskStatus[ChartPlotWidget] = trio.TASK_STATUS_IGNORED, @@ -710,9 +711,9 @@ async def open_vlm_displays( _, _, vlm_curve = vlm_viz.update_graphics() # size view to data once at outset - vlm_chart.view._set_yrange( - viz=vlm_viz - ) + # vlm_chart.view._set_yrange( + # viz=vlm_viz + # ) # add axis title axis = vlm_chart.getAxis('right') @@ -734,22 +735,8 @@ async def open_vlm_displays( }, }, }, - # loglevel, + loglevel, ) - tasks_ready.append(started) - - # FIXME: we should error on starting the same fsp right - # since it might collide with existing shm.. or wait we - # had this before?? - # dolla_vlm - - tasks_ready.append(started) - # profiler(f'created shm for fsp actor: {display_name}') - - # wait for all engine tasks to startup - async with trio.open_nursery() as n: - for event in tasks_ready: - n.start_soon(event.wait) # dolla vlm overlay # XXX: the main chart already contains a vlm "units" axis @@ -825,6 +812,7 @@ async def open_vlm_displays( ) assert viz.plot is pi + await started.wait() chart_curves( dvlm_fields, dvlm_pi, @@ -833,19 +821,17 @@ async def open_vlm_displays( step_mode=True, ) - # spawn flow rates fsp **ONLY AFTER** the 'dolla_vlm' fsp is - # up since this one depends on it. - + # NOTE: spawn flow rates fsp **ONLY AFTER** the 'dolla_vlm' fsp is + # up since calculating vlm "rates" obvs first requires the + # underlying vlm event feed ;) fr_flume, started = await admin.start_engine_task( flow_rates, { # fsp engine conf 'func_name': 'flow_rates', 'zero_on_step': True, }, - # loglevel, + loglevel, ) - await started.wait() - # chart_curves( # dvlm_rate_fields, # dvlm_pi, @@ -888,6 +874,7 @@ async def open_vlm_displays( ) tr_pi.hideAxis('bottom') + await started.wait() chart_curves( trade_rate_fields, tr_pi,