Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log no websocket connection as error, not debug #6111

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/_ert_job_runner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
def __enter__(self) -> Self:
return self

def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> None:

Check failure on line 32 in src/_ert_job_runner/client.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (82 > 79 characters)
if self.websocket is not None:
self.loop.run_until_complete(self.websocket.close())
self.loop.close()
Expand Down Expand Up @@ -109,7 +109,8 @@
if retry == self._max_retries:
_error_msg = (
f"Not able to establish the "
f"websocket connection {self.url}! Max retries reached!"

Check failure on line 112 in src/_ert_job_runner/client.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (80 > 79 characters)
" Check for firewall issues."
f" Exception from {type(exception)}: {str(exception)}"
)
raise ClientConnectionError(_error_msg) from exception
Expand All @@ -128,7 +129,7 @@
self.loop.run_until_complete(self._send(msg))

def send_event(
self, ev_type: str, ev_source: str, ev_data: Optional[Dict[str, Any]] = None

Check failure on line 132 in src/_ert_job_runner/client.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (84 > 79 characters)
) -> None:
if ev_data is None:
ev_data = {}
Expand Down
2 changes: 1 addition & 1 deletion src/_ert_job_runner/reporting/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
"report" to the given connection information.

An Init event must provided as the first message, which starts reporting,
and a Finish event will signal the reporter that the last event has been reported.

Check failure on line 46 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (86 > 79 characters)

If event fails to be sent (eg. due to connection error) it does not proceed to the

Check failure on line 48 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (86 > 79 characters)
next event but instead tries to re-send the same event.

Whenever the Finish event (when all the jobs have exited) is provided
the reporter will try to send all remaining events for a maximum of 60 seconds

Check failure on line 52 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (82 > 79 characters)
before stopping the reporter. Any remaining events will not be sent.
"""

Expand All @@ -65,18 +65,18 @@

self._statemachine = StateMachine()
self._statemachine.add_handler((Init,), self._init_handler)
self._statemachine.add_handler((Start, Running, Exited), self._job_handler)

Check failure on line 68 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (83 > 79 characters)
self._statemachine.add_handler((Finish,), self._finished_handler)

self._ens_id = None
self._real_id = None
self._step_id = None
self._event_queue = queue.Queue()
self._event_publisher_thread = threading.Thread(target=self._event_publisher)

Check failure on line 75 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (85 > 79 characters)
self._sentinel = object() # notifying the queue's ended
self._timeout_timestamp = None
self._timestamp_lock = threading.Lock()
# seconds to timeout the reporter the thread after Finish() was received

Check failure on line 79 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (80 > 79 characters)
self._reporter_timeout = 60

def _event_publisher(self):
Expand Down Expand Up @@ -106,7 +106,7 @@
event = None
except ClientConnectionError as exception:
# Possible intermittent failure, we retry sending the event
logger.debug(str(exception))
logger.error(str(exception))
pass
except ClientConnectionClosedOK as exception:
# The receiving end has closed the connection, we stop
Expand All @@ -126,7 +126,7 @@
self._event_queue.put(event)

def _step_path(self):
return f"/ert/ensemble/{self._ens_id}/real/{self._real_id}/step/{self._step_id}"

Check failure on line 129 in src/_ert_job_runner/reporting/event.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (88 > 79 characters)

def _init_handler(self, msg):
self._ens_id = msg.ens_id
Expand Down
Loading