Mucking with custom `msgspec.Struct` codecs
Syncs with https://github.com/goodboy/tractor/pull/311 which is nowhere near ready and this approach didn't end up being as straight forward as hoped. We're going to need a top level `Msg`-boxing type/protocol in `tractor` first...tractor_typed_msg_hackin
parent
de91c2196d
commit
d31c38ef51
|
@ -22,13 +22,13 @@ from typing import Optional, Union, Callable, Any
|
|||
from contextlib import asynccontextmanager as acm
|
||||
from collections import defaultdict
|
||||
|
||||
from msgspec import Struct
|
||||
import tractor
|
||||
import trio
|
||||
from trio_typing import TaskStatus
|
||||
|
||||
from .log import get_logger, get_console_log
|
||||
from .brokers import get_brokermod
|
||||
from .data.types import Struct
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
@ -204,6 +204,9 @@ async def open_piker_runtime(
|
|||
assert _services is None
|
||||
|
||||
# XXX: this may open a root actor as well
|
||||
with tractor.msg.configure_native_msgs(
|
||||
[Struct],
|
||||
):
|
||||
async with (
|
||||
tractor.open_root_actor(
|
||||
|
||||
|
@ -260,6 +263,10 @@ async def maybe_open_pikerd(
|
|||
if loglevel:
|
||||
get_console_log(loglevel)
|
||||
|
||||
# XXX: this may open a root actor as well
|
||||
with tractor.msg.configure_native_msgs(
|
||||
[Struct],
|
||||
):
|
||||
# subtle, we must have the runtime up here or portal lookup will fail
|
||||
async with maybe_open_runtime(loglevel, **kwargs):
|
||||
|
||||
|
@ -442,7 +449,7 @@ async def spawn_brokerd(
|
|||
)
|
||||
|
||||
# non-blocking setup of brokerd service nursery
|
||||
from .data import _setup_persistent_brokerd
|
||||
from .data.feed import _setup_persistent_brokerd
|
||||
|
||||
await _services.start_service_task(
|
||||
dname,
|
||||
|
|
Loading…
Reference in New Issue