From 446704e7911a021fd8c1f133c3ca687477c4ed54 Mon Sep 17 00:00:00 2001 From: xjules Date: Mon, 16 Dec 2024 13:23:32 +0100 Subject: [PATCH] Reorder methods and remove comment --- src/_ert/forward_model_runner/client.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/_ert/forward_model_runner/client.py b/src/_ert/forward_model_runner/client.py index 0892a26eecb..1e7dac4b15f 100644 --- a/src/_ert/forward_model_runner/client.py +++ b/src/_ert/forward_model_runner/client.py @@ -35,10 +35,6 @@ def __enter__(self) -> Self: self.loop.run_until_complete(self.__aenter__()) return self - def term(self) -> None: - self.socket.close() - self.context.term() - def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> None: self.loop.run_until_complete(self.__aexit__(exc_type, exc_value, exc_traceback)) self.loop.close() @@ -59,6 +55,10 @@ async def __aexit__( await self._term_receiver_task() self.term() + def term(self) -> None: + self.socket.close() + self.context.term() + async def _term_receiver_task(self) -> None: if self._receiver_task and not self._receiver_task.done(): self._receiver_task.cancel() @@ -76,7 +76,6 @@ def __init__( self.url = url self.token = token - # Set up ZeroMQ context and socke self._ack_event: asyncio.Event = asyncio.Event() self.context = zmq.asyncio.Context() self.socket = self.context.socket(zmq.DEALER) @@ -111,7 +110,7 @@ def send(self, message: str, retries: int | None = None) -> None: self.loop.run_until_complete(self._send(message, retries)) async def process_message(self, msg: str) -> None: - pass + raise NotImplementedError("Only monitor can receive messages!") async def _receiver(self) -> None: while True: