simvue-io / simvue-io/python-api

Logging Handler often encounters errors

Đang mở
#987 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug
Ngôn ngữ chính
Python
Star
4
Fork
1
Merge trung bình
5 ngày 8 giờ
Pull request đã merge (30 ngày)
4

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với phương thức emit của logging handler trong simvue/handler.py, sau đó lần theo lời gọi từ simvue_fds/connector.py::_parse_slice và _slice_parser được hiển thị trong traceback. Tái hiện cảnh báo máy chủ đã lỗi thời trong khi Run context đang hoạt động và xác định lý do handler đi tới log_event sau khi lần chạy rời khỏi trạng thái running. Hoàn tất khi cảnh báo không còn tạo ra logging error được báo cáo và hành vi này được bao phủ bởi một test phù hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
observability
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.