Adjust FSP UI/mgmt apis to be `Flume` oriented
parent
99bba1240d
commit
d03a566e40
|
@ -42,6 +42,7 @@ from ..data._sharedmem import (
|
||||||
_Token,
|
_Token,
|
||||||
try_read,
|
try_read,
|
||||||
)
|
)
|
||||||
|
from ..data.feed import Flume
|
||||||
from ._chart import (
|
from ._chart import (
|
||||||
ChartPlotWidget,
|
ChartPlotWidget,
|
||||||
LinkedSplits,
|
LinkedSplits,
|
||||||
|
@ -110,7 +111,8 @@ def update_fsp_chart(
|
||||||
# sub-charts reference it under different 'named charts'.
|
# sub-charts reference it under different 'named charts'.
|
||||||
|
|
||||||
# read from last calculated value and update any label
|
# read from last calculated value and update any label
|
||||||
last_val_sticky = chart._ysticks.get(graphics_name)
|
last_val_sticky = chart.plotItem.getAxis(
|
||||||
|
'right')._stickies.get(graphics_name)
|
||||||
if last_val_sticky:
|
if last_val_sticky:
|
||||||
last = last_row[array_key]
|
last = last_row[array_key]
|
||||||
last_val_sticky.update_from_data(-1, last)
|
last_val_sticky.update_from_data(-1, last)
|
||||||
|
@ -362,7 +364,7 @@ class FspAdmin:
|
||||||
tn: trio.Nursery,
|
tn: trio.Nursery,
|
||||||
cluster: dict[str, tractor.Portal],
|
cluster: dict[str, tractor.Portal],
|
||||||
linked: LinkedSplits,
|
linked: LinkedSplits,
|
||||||
src_shm: ShmArray,
|
flume: Flume,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
self.tn = tn
|
self.tn = tn
|
||||||
|
@ -374,7 +376,7 @@ class FspAdmin:
|
||||||
tuple[tractor.MsgStream, ShmArray]
|
tuple[tractor.MsgStream, ShmArray]
|
||||||
] = {}
|
] = {}
|
||||||
self._flow_registry: dict[_Token, str] = {}
|
self._flow_registry: dict[_Token, str] = {}
|
||||||
self.src_shm = src_shm
|
self.flume = flume
|
||||||
|
|
||||||
def rr_next_portal(self) -> tractor.Portal:
|
def rr_next_portal(self) -> tractor.Portal:
|
||||||
name, portal = next(self._rr_next_actor)
|
name, portal = next(self._rr_next_actor)
|
||||||
|
@ -409,7 +411,7 @@ class FspAdmin:
|
||||||
fqsn=fqsn,
|
fqsn=fqsn,
|
||||||
|
|
||||||
# mems
|
# mems
|
||||||
src_shm_token=self.src_shm.token,
|
src_shm_token=self.flume.rt_shm.token,
|
||||||
dst_shm_token=dst_shm.token,
|
dst_shm_token=dst_shm.token,
|
||||||
|
|
||||||
# target
|
# target
|
||||||
|
@ -469,7 +471,7 @@ class FspAdmin:
|
||||||
|
|
||||||
) -> (ShmArray, trio.Event):
|
) -> (ShmArray, trio.Event):
|
||||||
|
|
||||||
fqsn = self.linked.symbol.front_fqsn()
|
fqsn = self.flume.symbol.fqsn
|
||||||
|
|
||||||
# allocate an output shm array
|
# allocate an output shm array
|
||||||
key, dst_shm, opened = maybe_mk_fsp_shm(
|
key, dst_shm, opened = maybe_mk_fsp_shm(
|
||||||
|
@ -478,7 +480,7 @@ class FspAdmin:
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
self._flow_registry[(
|
self._flow_registry[(
|
||||||
self.src_shm._token,
|
self.flume.rt_shm._token,
|
||||||
target.name
|
target.name
|
||||||
)] = dst_shm._token
|
)] = dst_shm._token
|
||||||
|
|
||||||
|
@ -540,7 +542,7 @@ class FspAdmin:
|
||||||
@acm
|
@acm
|
||||||
async def open_fsp_admin(
|
async def open_fsp_admin(
|
||||||
linked: LinkedSplits,
|
linked: LinkedSplits,
|
||||||
src_shm: ShmArray,
|
flume: Flume,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
|
|
||||||
) -> AsyncGenerator[dict, dict[str, tractor.Portal]]:
|
) -> AsyncGenerator[dict, dict[str, tractor.Portal]]:
|
||||||
|
@ -561,7 +563,7 @@ async def open_fsp_admin(
|
||||||
tn,
|
tn,
|
||||||
cluster_map,
|
cluster_map,
|
||||||
linked,
|
linked,
|
||||||
src_shm,
|
flume,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
yield admin
|
yield admin
|
||||||
|
@ -575,7 +577,7 @@ async def open_fsp_admin(
|
||||||
async def open_vlm_displays(
|
async def open_vlm_displays(
|
||||||
|
|
||||||
linked: LinkedSplits,
|
linked: LinkedSplits,
|
||||||
ohlcv: ShmArray,
|
flume: Flume,
|
||||||
dvlm: bool = True,
|
dvlm: bool = True,
|
||||||
|
|
||||||
task_status: TaskStatus[ChartPlotWidget] = trio.TASK_STATUS_IGNORED,
|
task_status: TaskStatus[ChartPlotWidget] = trio.TASK_STATUS_IGNORED,
|
||||||
|
@ -597,6 +599,8 @@ async def open_vlm_displays(
|
||||||
sig = inspect.signature(flow_rates.func)
|
sig = inspect.signature(flow_rates.func)
|
||||||
params = sig.parameters
|
params = sig.parameters
|
||||||
|
|
||||||
|
ohlcv: ShmArray = flume.rt_shm
|
||||||
|
|
||||||
async with (
|
async with (
|
||||||
open_fsp_sidepane(
|
open_fsp_sidepane(
|
||||||
linked, {
|
linked, {
|
||||||
|
@ -616,7 +620,7 @@ async def open_vlm_displays(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
) as sidepane,
|
) as sidepane,
|
||||||
open_fsp_admin(linked, ohlcv) as admin,
|
open_fsp_admin(linked, flume) as admin,
|
||||||
):
|
):
|
||||||
# TODO: support updates
|
# TODO: support updates
|
||||||
# period_field = sidepane.fields['period']
|
# period_field = sidepane.fields['period']
|
||||||
|
@ -644,6 +648,8 @@ async def open_vlm_displays(
|
||||||
# the curve item internals are pretty convoluted.
|
# the curve item internals are pretty convoluted.
|
||||||
style='step',
|
style='step',
|
||||||
)
|
)
|
||||||
|
# back-link the volume chart to trigger y-autoranging
|
||||||
|
# in the ohlc (parent) chart.
|
||||||
ohlc_chart.view.enable_auto_yrange(
|
ohlc_chart.view.enable_auto_yrange(
|
||||||
src_vb=chart.view,
|
src_vb=chart.view,
|
||||||
)
|
)
|
||||||
|
@ -685,7 +691,8 @@ async def open_vlm_displays(
|
||||||
assert chart.name != linked.chart.name
|
assert chart.name != linked.chart.name
|
||||||
|
|
||||||
# sticky only on sub-charts atm
|
# sticky only on sub-charts atm
|
||||||
last_val_sticky = chart._ysticks[chart.name]
|
last_val_sticky = chart.plotItem.getAxis(
|
||||||
|
'right')._stickies.get(chart.name)
|
||||||
|
|
||||||
# read from last calculated value
|
# read from last calculated value
|
||||||
value = shm.array['volume'][-1]
|
value = shm.array['volume'][-1]
|
||||||
|
@ -928,7 +935,7 @@ async def open_vlm_displays(
|
||||||
async def start_fsp_displays(
|
async def start_fsp_displays(
|
||||||
|
|
||||||
linked: LinkedSplits,
|
linked: LinkedSplits,
|
||||||
ohlcv: ShmArray,
|
flume: Flume,
|
||||||
group_status_key: str,
|
group_status_key: str,
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
|
|
||||||
|
@ -971,7 +978,10 @@ async def start_fsp_displays(
|
||||||
async with (
|
async with (
|
||||||
|
|
||||||
# NOTE: this admin internally opens an actor cluster
|
# NOTE: this admin internally opens an actor cluster
|
||||||
open_fsp_admin(linked, ohlcv) as admin,
|
open_fsp_admin(
|
||||||
|
linked,
|
||||||
|
flume,
|
||||||
|
) as admin,
|
||||||
):
|
):
|
||||||
statuses = []
|
statuses = []
|
||||||
for target, conf in fsp_conf.items():
|
for target, conf in fsp_conf.items():
|
||||||
|
|
Loading…
Reference in New Issue