From c9cf72d554bc4f09d2cfd442bd524e61eaecfb83 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 23 May 2021 10:53:57 -0400 Subject: [PATCH] Add remote context allocation api to service daemon This allows for more deterministically managing long running sub-daemon services under `pikerd` using the new context api from `tractor`. The contexts are allocated in an async exit stack and torn down at root daemon termination. Spawn brokerds using this method by changing the persistence entry point to be a `@tractor.context`. --- piker/_daemon.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/piker/_daemon.py b/piker/_daemon.py index 30fdfec2..4c37812d 100644 --- a/piker/_daemon.py +++ b/piker/_daemon.py @@ -18,7 +18,6 @@ Structured, daemon tree service management. """ -from functools import partial from typing import Optional, Union, Callable, Any from contextlib import asynccontextmanager, AsyncExitStack from collections import defaultdict @@ -72,7 +71,7 @@ class Services(BaseModel): ctx, first = await self.ctx_stack.enter_async_context( portal.open_context( target, - **kwargs, + **kwargs, ) ) return ctx