Skip to content

Commit

Permalink
Make use of event.stop() when handling finished event
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Dec 16, 2024
1 parent 86d7fe6 commit 4392292
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/_ert/forward_model_runner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ async def send(self, message: str, retries: int | None = None) -> None:
self._ack_event.clear()

backoff = 1
retries = retries or self.DEFAULT_MAX_RETRIES
if retries is None:
retries = self.DEFAULT_MAX_RETRIES
while retries >= 0:
try:
await self.socket.send_multipart([b"", message.encode("utf-8")])
Expand Down
5 changes: 1 addition & 4 deletions src/_ert/forward_model_runner/reporting/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ def _job_handler(self, msg: Start | Running | Exited):
self._dump_event(event)

def _finished_handler(self, _):
self._event_queue.put(Event._sentinel)
self._done.set()
if self._event_publisher_thread.is_alive():
self._event_publisher_thread.join()
self.stop()

def _checksum_handler(self, msg: Checksum):
fm_checksum = ForwardModelStepChecksum(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_report_with_failed_reporter_but_finished_jobs(unused_tcp_port):
url = f"tcp://{host}:{unused_tcp_port}"
with MockZMQServer(unused_tcp_port) as mock_server:
reporter = Event(
evaluator_url=url, ack_timeout=2, max_retries=1, finished_event_timeout=2
evaluator_url=url, ack_timeout=2, max_retries=0, finished_event_timeout=2
)
fmstep1 = ForwardModelStep(
{"name": "fmstep1", "stdout": "stdout", "stderr": "stderr"}, 0
Expand Down

0 comments on commit 4392292

Please sign in to comment.