Skip to content

Databroker not handling config ophyd EnumSignal correctly #861

@evvaaaa

Description

@evvaaaa

Summary

I cannot export some tiled entries in my database because they have baseline readings including a noisy_det, with a value saved as a string. Databroker attempts to parse this into it's integer value.

When I try to export I get

In [11]: db["d209435e-c757-4705-a127-928fe0c3c831"].export("d209435e-c757-4705-a127-928fe0c3c831.json")
Scheduled retry in 1.0 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID faa4b9bb86660cf9.") (attempt 1)
Scheduled retry in 0.39 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID 19ad93cd5f042200.") (attempt 2)
Scheduled retry in 0.65 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID e4ee93f46e0842c6.") (attempt 3)
Scheduled retry in 1.2 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID f75880b2eef25716.") (attempt 4)
Scheduled retry in 2.1 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID 1ecef1f0d42f40d7.") (attempt 5)
Scheduled retry in 3.7 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID 2d5ed01b9cf7e704.") (attempt 6)
Scheduled retry in 5.0 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/container/full/d209435e-c757-4705-a127-928fe0c3c831?format=json'\nFor more information, server admin can search server logs for correlation ID f36b126aebd31697.") (attempt 7)

corresponding to the error

tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
tiled                   |     await app(scope, receive, sender)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 715, in __call__
tiled                   |     await self.middleware_stack(scope, receive, send)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 735, in app
tiled                   |     await route.handle(scope, receive, send)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle
tiled                   |     await self.app(scope, receive, send)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 76, in app
tiled                   |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
tiled                   |     raise exc
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
tiled                   |     await app(scope, receive, sender)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 73, in app
tiled                   |     response = await f(request)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 291, in app
tiled                   |     solved_result = await solve_dependencies(
tiled                   |   File "/usr/local/lib/python3.10/site-packages/fastapi/dependencies/utils.py", line 628, in solve_dependencies
tiled                   |     solved = await call(**solved_result.values)
tiled                   |   File "/usr/local/lib/python3.10/site-packages/tiled/server/dependencies.py", line 99, in inner
tiled                   |     entry = entry[segment]
tiled                   |   File "/usr/local/lib/python3.10/site-packages/tiled/adapters/mapping.py", line 223, in __getitem__
tiled                   |     return self._mapping[key]
tiled                   |   File "/usr/local/lib/python3.10/site-packages/tiled/utils.py", line 148, in __getitem__
tiled                   |     v = self.__mapping[key] = v.func()
tiled                   |   File "/usr/local/lib/python3.10/site-packages/databroker/mongo_normalized.py", line 1564, in <lambda>
tiled                   |     object_name: lambda object_name=object_name: build_config_xarray(
tiled                   |   File "/usr/local/lib/python3.10/site-packages/databroker/mongo_normalized.py", line 1075, in build_config_xarray
tiled                   |     columns[key] = numpy.array(column, dtype=numpy_dtype)
tiled                   | ValueError: invalid literal for int() with base 10: 'uniform'

I also can't delete this data and move on because I get the same error:

In [16]: db["d209435e-c757-4705-a127-928fe0c3c831"]["primary"]["config"]
Out[16]: <Container {'noisy_det'}>

In [17]: db["d209435e-c757-4705-a127-928fe0c3c831"]["primary"]["config"].delete_contents("noisy_det")
Scheduled retry in 0.64 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/metadata/d209435e-c757-4705-a127-928fe0c3c831/primary/config/noisy_det?recursive=false&external_only=true'\nFor more information, server admin can search server logs for correlation ID 5b92e610fc32b714.") (attempt 1)
Scheduled retry in 0.89 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/metadata/d209435e-c757-4705-a127-928fe0c3c831/primary/config/noisy_det?recursive=false&external_only=true'\nFor more information, server admin can search server logs for correlation ID 11bd2fa09ed4dfa5.") (attempt 2)
Scheduled retry in 0.9 seconds due to HTTPStatusError("Server error '500 Internal Server Error' for url 'http://localhost:8000/api/v1/metadata/d209435e-c757-4705-a127-928fe0c3c831/primary/config/noisy_det?recursive=false&external_only=true'\nFor more information, server admin can search server logs for correlation ID 7a6f21258db2c9af.") (attempt 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions