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

Merged

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
@GitHK GitHK enabled auto-merge (squash) January 6, 2025 13:35
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.97%. Comparing base (61a78bc) to head (d812dc3).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6989      +/-   ##
==========================================
+ Coverage   86.91%   87.97%   +1.05%     
==========================================
  Files        1630     1148     -482     
  Lines       64378    49709   -14669     
  Branches     2035      308    -1727     
==========================================
- Hits        55956    43730   -12226     
+ Misses       8088     5906    -2182     
+ Partials      334       73     -261     
Flag Coverage Δ
integrationtests 64.49% <100.00%> (+0.99%) ⬆️
unittests 86.62% <100.00%> (+1.31%) ⬆️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration ∅ <ø> (∅)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.38% <ø> (ø)
agent 96.82% <ø> (ø)
api_server 90.13% <ø> (ø)
autoscaling 96.09% <ø> (ø)
catalog 90.57% <ø> (ø)
clusters_keeper 99.48% <ø> (ø)
dask_sidecar 91.26% <ø> (ø)
datcore_adapter 93.18% <ø> (ø)
director 76.40% <ø> (ø)
director_v2 91.38% <ø> (ø)
dynamic_scheduler 97.19% <100.00%> (ø)
dynamic_sidecar 89.75% <ø> (ø)
efs_guardian 90.12% <ø> (ø)
invitations 93.44% <ø> (ø)
osparc_gateway_server ∅ <ø> (∅)
payments 92.66% <ø> (ø)
resource_usage_tracker 89.56% <ø> (+0.17%) ⬆️
storage 89.54% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 84.14% <100.00%> (-0.02%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a78bc...d812dc3. Read the comment docs.

Copy link

sonarqubecloud bot commented Jan 6, 2025

@GitHK GitHK merged commit 116a6c0 into ITISFoundation:master Jan 6, 2025
92 of 93 checks passed
@GitHK GitHK deleted the pr-osparc-fixed-dynamic-scheduler-ui branch January 6, 2025 15:16
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.

5 participants