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

🐛 Fixed issue with query params validation in dynamic-scheduler #6989

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GitHK
Copy link
Contributor

@GitHK GitHK commented Dec 20, 2024

What do these changes do?

Fixes an issue where parameters get incorrectly serialised to empty string http://master_director-v2:8000/v2/dynamic_services?user_id=&project_id=.

The issue was a wrong assumption made by the escaping function.

log_level=ERROR | log_timestamp=2024-12-20 12:38:24,338 | log_source=rpc.access:_wrapper(67) | log_uid=None | log_oec=None| log_trace_id=0 | log_span_id=0 | log_resource.service.name= | log_trace_sampled=False] | log_msg=Unhandled exception on the rpc-server side. Re-raising as RPCServerError.
Traceback (most recent call last):
  File "/home/scu/.venv/lib/python3.11/site-packages/servicelib/rabbitmq/_rpc_router.py", line 55, in _wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_dynamic_scheduler/api/rpc/_services.py", line 32, in list_tracked_dynamic_services
    return await scheduler_interface.list_tracked_dynamic_services(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_dynamic_scheduler/services/scheduler_interface.py", line 31, in list_tracked_dynamic_services
    return await director_v2_client.list_tracked_dynamic_services(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_dynamic_scheduler/services/director_v2/_public_client.py", line 124, in list_tracked_dynamic_services
    response = await self.thin_client.get_dynamic_services(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/servicelib/fastapi/http_client_thin.py", line 139, in request_wrapper
    async for attempt in AsyncRetrying(
  File "/home/scu/.venv/lib/python3.11/site-packages/tenacity/asyncio/__init__.py", line 166, in __anext__
    do = await self.iter(retry_state=self._retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/tenacity/_utils.py", line 99, in inner
    return call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/scu/.venv/lib/python3.11/site-packages/servicelib/fastapi/http_client_thin.py", line 152, in request_wrapper
    return await request_func(zelf, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/servicelib/fastapi/http_client_thin.py", line 189, in request_wrapper
    raise UnexpectedStatusError(response=response, expecting=expected_code)
servicelib.fastapi.http_client_thin.UnexpectedStatusError: Expected status: 200, got 422 for: http://master_director-v2:8000/v2/dynamic_services?user_id=&project_id=: headers=Headers({'date': 'Fri, 20 Dec 2024 12:38:23 GMT', 'server': 'uvicorn', 'content-length': '394', 'content-type': 'application/json'}), body='{"errors":[{"type":"int_parsing","loc":["query","user_id"],"msg":"Input should be a valid integer, unable to parse string as an integer","input":""},{"type":"uuid_parsing","loc":["query","project_id"],"msg":"Input should be a valid UUID, invalid length: expected length 32 for simple format, found 0","input":"","ctx":{"error":"invalid length: expected length 32 for simple format, found 0"}}]}'

Related issue/s

How to test

Dev-ops checklist

@GitHK GitHK self-assigned this Dec 20, 2024
@GitHK GitHK added a:dynamic-scheduler bug buggy, it does not work as expected t:maintenance Some planned maintenance work labels Dec 20, 2024
@GitHK GitHK added this to the Event Horizon milestone Dec 20, 2024
@GitHK GitHK marked this pull request as ready for review December 20, 2024 14:44
@GitHK GitHK changed the title 🐛 Fixed issue with query params validation 🐛 Fixed issue with query params validation in dynamic-scheduler Dec 20, 2024
@GitHK GitHK requested a review from pcrespov December 23, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:dynamic-scheduler bug buggy, it does not work as expected t:maintenance Some planned maintenance work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants