DiamondLightSource / blueapi

Apache License 2.0
6 stars 6 forks source link

Deserialisation errors in CLI client #280

Open tpoliaw opened 1 year ago

tpoliaw commented 1 year ago

Now all messages/events are sent on the same topic, the cli needs to check the type of each message received. Currently running an example plan raises many exceptions similar to

Exception in thread: 3 validation errors for ParsingModel[WorkerEvent]
__root__ -> state
  field required (type=value_error.missing)
__root__ -> doc
  extra fields not permitted (type=value_error.extra)
__root__ -> name
  extra fields not permitted (type=value_error.extra)
Traceback (most recent call last):
  File "/dls/athena/blueapi/src/blueapi/utils/thread_exception.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/dls/athena/blueapi/src/blueapi/messaging/stomptemplate.py", line 232, in _on_message
    sub.callback(frame)
  File "/dls/athena/blueapi/src/blueapi/messaging/stomptemplate.py", line 151, in wrapper
    value = parse_obj_as(obj_type, as_dict)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/tools.py", line 38, in pydantic.tools.parse_obj_as
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 3 validation errors for ParsingModel[WorkerEvent]
__root__ -> state
  field required (type=value_error.missing)
__root__ -> doc
  extra fields not permitted (type=value_error.extra)
__root__ -> name
  extra fields not permitted (type=value_error.extra)
tpoliaw commented 1 year ago

Potential workaround in #249 to attempt to de-serialise DataEvents as well as WorkerEventss and then ignore everything it doesn't need.

stan-dot commented 8 months ago

@tpoliaw what are the steps to reproduce the issue?

stan-dot commented 8 months ago

potentially connected to #206