simvue-io / simvue-io/python-api

Logging Handler often encounters errors

Abierto
#987 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug
Lenguaje dominante
Python
Estrellas
4
Forks
1
Merge medio
5 d 8 h
PR fusionados (30 d)
4

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el método emit del manejador de logging en simvue/handler.py y luego sigue la llamada desde simvue_fds/connector.py::_parse_slice y _slice_parser que aparece en el traceback. Reproduce la advertencia sobre el servidor obsoleto mientras el contexto de Run está activo y determina por qué el manejador llega a log_event después de que la ejecución abandona el estado running. El trabajo estará terminado cuando la advertencia ya no produzca el error de logging informado y el comportamiento esté cubierto por una prueba adecuada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
observability
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.