simvue-io / simvue-io/python-api

Logging Handler often encounters errors

Open
#987 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
4
Forks
1
Avg merge
5d 8h
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the logging handler's emit method in simvue/handler.py, then trace the call from simvue_fds/connector.py::_parse_slice and _slice_parser shown in the traceback. Reproduce the out-of-date-server warning while the Run context is active and determine why the handler reaches log_event after the run leaves the running state. Done means the warning no longer produces the reported logging error, with the behavior covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.