Skip to content

Commit

Permalink
Reorder methods and remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Dec 16, 2024
1 parent 7762f6f commit 446704e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/_ert/forward_model_runner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 446704e

Please sign in to comment.