Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server] Exception in ASGI application with Token Classification datasets (rubrix.server.errors.base_errors.EntityNotFoundError) #1551

Closed
dvsrepo opened this issue Jun 9, 2022 · 4 comments
Assignees
Labels
type: bug Indicates an unexpected problem or unintended behavior
Projects
Milestone

Comments

@dvsrepo
Copy link
Member

dvsrepo commented Jun 9, 2022

Describe the bug
When logging token classification data, and loading the dataset page in the webapp, the server shows this error trace:

022-06-09 14:38:17.855 | ERROR    | uvicorn.protocols.http.httptools_impl:run_asgi:370 - Exception in ASGI application

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
           │         │     └ {'__name__': '__main__', '__doc__': None, '__package__': 'rubrix', '__loader__': <_frozen_importlib_external.SourceFileLoader...
           │         └ <code object <module> at 0x108cda7c0, file "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rub...
           └ <function _run_code at 0x1082a64c0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
         │     └ {'__name__': '__main__', '__doc__': None, '__package__': 'rubrix', '__loader__': <_frozen_importlib_external.SourceFileLoader...
         └ <code object <module> at 0x108cda7c0, file "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rub...
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rubrix/__main__.py", line 19, in <module>
    uvicorn.run(
    │       └ <function run at 0x108f968b0><module 'uvicorn' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/uvicorn/__init__.py'>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/uvicorn/main.py", line 461, in run
    server.run()
    │      └ <function Server.run at 0x108fb08b0><uvicorn.server.Server object at 0x1080ffbb0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x108fb0940>
           │       │   └ <uvicorn.server.Server object at 0x1080ffbb0>
           │       └ <function run at 0x108a76700><module 'asyncio' from '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/__init__.py'>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x109027dc0>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects><uvloop.Loop running=True closed=False debug=False>
> File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 367, in run_asgi
    result = await app(self.scope, self.receive, self.send)
                   │   │    │      │    │        │    └ <function RequestResponseCycle.send at 0x109349790>
                   │   │    │      │    │        └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47f0>
                   │   │    │      │    └ <function RequestResponseCycle.receive at 0x109349820>
                   │   │    │      └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47f0>
                   │   │    └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
                   │   └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47f0><uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x109066fa0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47f0>>
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
                 │    └ <fastapi.applications.FastAPI object at 0x1094760a0><uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x109066fa0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastapi/applications.py", line 261, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47f0>>
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47f0>>
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x1276b8040><fastapi.applications.FastAPI object at 0x1094760a0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x127a69a60>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <brotli_asgi.BrotliMiddleware object at 0x1276cba00><starlette.middleware.errors.ServerErrorMiddleware object at 0x1276b8040>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/brotli_asgi/__init__.py", line 72, in __call__
    await responder(scope, receive, send)
          │         │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x127a69a60>
          │         │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │         └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          └ <brotli_asgi.BrotliResponder object at 0x1277ffc70>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/brotli_asgi/__init__.py", line 111, in __call__
    await self.app(scope, receive, self.send_with_brotli)
          │    │   │      │        │    └ <function BrotliResponder.send_with_brotli at 0x109648f70>
          │    │   │      │        └ <brotli_asgi.BrotliResponder object at 0x1277ffc70>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <starlette.middleware.cors.CORSMiddleware object at 0x1276cbc70><brotli_asgi.BrotliResponder object at 0x1277ffc70>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
          │    │   │      │        └ <bound method BrotliResponder.send_with_brotli of <brotli_asgi.BrotliResponder object at 0x1277ffc70>>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <starlette.exceptions.ExceptionMiddleware object at 0x1276cbe20><starlette.middleware.cors.CORSMiddleware object at 0x1276cbc70>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
          │    │   │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x127a69dc0>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x1276cbe80><starlette.exceptions.ExceptionMiddleware object at 0x1276cbe20>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
          │    │   │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x127a69dc0>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <fastapi.routing.APIRouter object at 0x109476100><fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x1276cbe80>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x127a69dc0>
          │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │     └ <function Route.handle at 0x10a0451f0><fastapi.routing.APIRoute object at 0x1272b1bb0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x127a69dc0>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x10a5d47...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 6900), 'cl...
          │    └ <function request_response.<locals>.app at 0x12782cf70><fastapi.routing.APIRoute object at 0x1272b1bb0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
                     │    └ <starlette.requests.Request object at 0x10a5d99d0><function get_request_handler.<locals>.app at 0x12782cee0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastapi/routing.py", line 227, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x10a035280>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
    return await dependant.call(**values)
                 │         │      └ {'ws_params': CommonTaskQueryParams(__workspace_param__=None, __workspace_header__='rubrix'), 'datasets': <rubrix.server.serv...
                 │         └ <function configure_router.<locals>.get_dataset_settings at 0x12724fc10><fastapi.dependencies.models.Dependant object at 0x1272c5220>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rubrix/server/apis/v0/handlers/token_classification_dataset_settings.py", line 47, in get_dataset_settings
    settings = await datasets.get_settings(
                     │        └ <function DatasetsService.get_settings at 0x126cff670><rubrix.server.services.datasets.DatasetsService object at 0x1277d33a0>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/rubrix/server/services/datasets.py", line 243, in get_settings
    raise EntityNotFoundError(name=dataset.name, type=class_type)
          │                        │       │          └ <class 'abc.TokenClassification_DatasetSettings'>
          │                        │       └ 'test'
          │                        └ DatasetDB(tags={}, metadata={}, name='test', task=<TaskType.token_classification: 'TokenClassification'>, owner='rubrix', cre...
          └ <class 'rubrix.server.errors.base_errors.EntityNotFoundError'>

rubrix.server.errors.base_errors.EntityNotFoundError: rubrix.api.errors::EntityNotFoundError(name=test,type=TokenClassification_DatasetSettings)

To Reproduce
Steps to reproduce the behavior:

  1. Log data with:

rb.log(name="test", records=rb.TokenClassificationRecord(text="hola dani", tokens=["hola", "dani"], prediction=[("name", 5,9, 0.8)]))
2. Go to 'localhost:6900/datasets/rubrix/test'
4. Apparently no issues in the UI itself, but you will see the error in the server logs

Environment (please complete the following information):

  • Rubrix Version [e.g. 0.10.0]: 0.15.0
  • ElasticSearch Version [e.g. 7.10.2]:
  • Docker Image (optional) [e.g. rubrix:v0.10.0]: No docker image

Additional context
Add any other context about the problem here.

@dvsrepo dvsrepo added the type: bug Indicates an unexpected problem or unintended behavior label Jun 9, 2022
@dvsrepo dvsrepo added this to Backlog in Release via automation Jun 9, 2022
@frascuchon
Copy link
Member

I think the Rubrix UI flow causes this error. The Rubrix UI finds settings for a given dataset accepting that the settings can be not found. So, it's a controlled error. @leiyre can confirm it.

We can decide just to trace a warning message for not found errors, instead of logging the complete error trace. In that case, we should close this issue and open a different one to tackle the warning message work.

@dvsrepo
Copy link
Member Author

dvsrepo commented Jun 9, 2022

Great! A warning message would be better yes.

The question would be: Will it be shown each and every time you have a token-classification dataset and load the results? Currently, it is shown every time you load some records (search, pagination, etc.). Also, not sure what a clear message should be but I guess it could easily get confusing

@frascuchon
Copy link
Member

Okay, I will investigate that behavior.

Thanks for reaching out, @dvsrepo!

@frascuchon
Copy link
Member

Fixed in #1569

Release automation moved this from Ready to Release QA to Waiting Release Jun 23, 2022
@frascuchon frascuchon moved this from Waiting Release to Ready to Release QA in Release Jul 5, 2022
@frascuchon frascuchon moved this from Ready to Release QA to Approved Release QA in Release Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Indicates an unexpected problem or unintended behavior
Projects
No open projects
Release
Approved Release QA
Development

Successfully merging a pull request may close this issue.

3 participants