Skip to content

Commit

Permalink
Mypy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Dec 18, 2024
1 parent c78f990 commit 2f61b9a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 54 deletions.
2 changes: 1 addition & 1 deletion src/ert/ensemble_evaluator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
self.router_port: int | None = None
self.url = f"ipc:///tmp/socket-{uuid.uuid4().hex[:8]}"
self.token: str | None = None
self._socket_handle: socket | None = None
self._socket_handle: socket.socket | None = None

self.server_public_key: bytes | None = None
self.server_secret_key: bytes | None = None
Expand Down
53 changes: 0 additions & 53 deletions tests/ert/unit_tests/forward_model_runner/test_event_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,56 +235,3 @@ def test_report_with_reconnected_reporter_but_finished_jobs(unused_tcp_port):
reporter._event_publisher_thread.join()
assert reporter._done.is_set()
assert len(mock_server.messages) == 3, "expected 3 Job running messages"


# REFACTOR maybe we don't this anymore
# @pytest.mark.integration_test
# def test_report_with_closed_received_exiting_gracefully(unused_tcp_port):
# mock_send_retry_time = 3

# def mock_send(msg):
# time.sleep(mock_send_retry_time)
# raise ClientConnectionClosedOK("Connection Closed")

# host = "localhost"
# url = f"tcp://{host}:{unused_tcp_port}"
# reporter = Event(evaluator_url=url)
# fmstep1 = ForwardModelStep(
# {"name": "fmstep1", "stdout": "stdout", "stderr": "stderr"}, 0
# )
# lines = []
# with mock_zmq_thread(unused_tcp_port, lines):
# reporter.report(Init([fmstep1], 1, 19, ens_id="ens_id", real_id=0))
# reporter.report(Running(fmstep1, ProcessTreeStatus(max_rss=100, rss=10)))
# reporter.report(Running(fmstep1, ProcessTreeStatus(max_rss=200, rss=10)))

# # sleep until both Running events have been received
# _wait_until(
# condition=lambda: len(lines) == 2,
# timeout=10,
# fail_msg="Should not take 10 seconds to send two events",
# )

# with patch(
# "_ert.forward_model_runner.client.Client.send",
# lambda x, y: mock_send(y),
# ):
# reporter.report(Running(fmstep1, ProcessTreeStatus(max_rss=300, rss=10)))
# # Make sure the publisher thread exits because it got
# # ClientConnectionClosedOK. If it hangs it could indicate that the
# # exception is not caught/handled correctly
# if reporter._event_publisher_thread.is_alive():
# reporter._event_publisher_thread.join()

# reporter.report(Running(fmstep1, ProcessTreeStatus(max_rss=400, rss=10)))
# reporter.report(Finish())

# # set _stop_timestamp was not set to None since the reporter finished on time
# assert reporter._timeout_timestamp is not None


# # The Running(fmstep1, 300, 10) is popped from the queue, but never sent.
# # The following Running is added to queue along with the sentinel
# assert reporter._event_queue.qsize() == 2
# # None of the messages after ClientConnectionClosedOK was raised, has been sent
# assert len(lines) == 2, "expected 2 Job running messages"

0 comments on commit 2f61b9a

Please sign in to comment.