Skip to content

Commit be10769

Browse files
committed
PipelineSettingsProducerSettings - expose graph_address
1 parent 9620a46 commit be10769

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/ezmsg/baseproc/util/pipeline_settings.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ class PipelineSettingsProducerSettings(ez.Settings):
256256
fills this in automatically by discovering its own session's components
257257
on initialize."""
258258

259+
graph_address: Optional[tuple[str, int]] = None
260+
"""Address of the ``GraphServer`` to connect to. ``None`` lets
261+
``GraphContext`` resolve the default (``EZMSG_GRAPHSERVER_ADDR`` env
262+
var, falling back to ``127.0.0.1:25978``). Set explicitly when running
263+
multiple parallel ezmsg systems, or in tests where ``ez.run`` was
264+
called with a non-default ``graph_address``."""
265+
259266

260267
@processor_state
261268
class PipelineSettingsProducerState:
@@ -320,7 +327,7 @@ async def _areset_state(self) -> None:
320327
self._state.initialized = False
321328

322329
try:
323-
ctx = ez.GraphContext(auto_start=False)
330+
ctx = ez.GraphContext(self.settings.graph_address, auto_start=False)
324331
await ctx.__aenter__()
325332
except Exception as exc:
326333
ez.logger.warning(f"PipelineSettingsProducer could not open GraphContext: {exc}")
@@ -486,6 +493,7 @@ async def initialize(self) -> None:
486493
PipelineSettingsProducerSettings(
487494
target_table=self.SETTINGS.target_table,
488495
scope_components=tuple(sorted(scope)),
496+
graph_address=self.SETTINGS.graph_address,
489497
)
490498
)
491499
await super().initialize()
@@ -500,7 +508,7 @@ async def shutdown(self) -> None:
500508
await super().shutdown()
501509

502510
async def _discover_session_scope(self) -> Optional[set[str]]:
503-
ctx = ez.GraphContext(auto_start=False)
511+
ctx = ez.GraphContext(self.SETTINGS.graph_address, auto_start=False)
504512
await ctx.__aenter__()
505513
try:
506514
snapshot = await ctx.snapshot()

0 commit comments

Comments
 (0)