simvue-io / simvue-io/python-api

Logging Handler often encounters errors

Offen
#987 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Python
Sterne
4
Forks
1
Ø Merge
5 T. 8 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Description of Bug

When using the logging handler, I often get errors similar to this:

--- Logging error ---
Traceback (most recent call last):
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/handler.py", line 38, in emit
    self._run_object.log_event(_msg)
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/utilities.py", line 317, in wrapper
    return class_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/run.py", line 115, in _wrapper
    return _function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/utilities.py", line 355, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py", line 40, in wrapper_function
    return wrapper(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py", line 137, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/run.py", line 1451, in log_event
    self._error("Cannot log events when not in the running state")
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/run.py", line 647, in _error
    raise SimvueRunError(message)
simvue.exception.SimvueRunError: Cannot log events when not in the running state
Call stack:
  File "/__t/Python/3.11.15/x64/lib/python3.11/threading.py", line 1002, in _bootstrap
    self._bootstrap_inner()
  File "/__t/Python/3.11.15/x64/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/__t/Python/3.11.15/x64/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/__w/connectors-fds/connectors-fds/simvue_fds/connector.py", line 877, in _slice_parser
    slice_parsed = self._parse_slice()
  File "/__w/connectors-fds/connectors-fds/simvue_fds/connector.py", line 801, in _parse_slice
    logger.warning(
  File "/__t/Python/3.11.15/x64/lib/python3.11/logging/__init__.py", line 1501, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/__t/Python/3.11.15/x64/lib/python3.11/logging/__init__.py", line 1634, in _log
    self.handle(record)
  File "/__t/Python/3.11.15/x64/lib/python3.11/logging/__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "/__t/Python/3.11.15/x64/lib/python3.11/logging/__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "/__t/Python/3.11.15/x64/lib/python3.11/logging/__init__.py", line 978, in handle
    self.emit(record)
  File "/github/home/.cache/pypoetry/virtualenvs/simvue-fds-CpC4W15U-py3.11/lib/python3.11/site-packages/simvue/handler.py", line 40, in emit
    logging.Handler.handleError(self, record)
Message: '\n                        Your Simvue server is out of date, and is running a noSim version\n                        which is lower than the version required to support OBSTs within 3D metrics.\n                        Ask your admin to upgrade to noSim version 1.6.4 or higher.\n                        Falling back to uploading OBSTs as zeros...\n                        '
Arguments: ()
WARNING simvue_fds.connector: 
                        Your Simvue server is out of date, and is running a noSim version
                        which is lower than the version required to support OBSTs within 3D metrics.
                        Ask your admin to upgrade to noSim version 1.6.4 or higher.
                        Falling back to uploading OBSTs as zeros...
                        

I'm not sure why its trying to send an event when the run is not in the running state, since the logging I am using always does logging within the Run context

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der emit-Methode des Logging-Handlers in simvue/handler.py und verfolge dann den Aufruf von simvue_fds/connector.py::_parse_slice und _slice_parser, der im Traceback angezeigt wird. Reproduziere die Warnung bezüglich des veralteten Servers, während der Run-Kontext aktiv ist, und ermittle, warum der Handler log_event erreicht, nachdem der Run den Zustand running verlassen hat. Erledigt ist die Aufgabe, wenn die Warnung nicht mehr den gemeldeten Logging-Fehler verursacht und das Verhalten durch einen geeigneten Test abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
observability
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.