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

HTTP Service invocation: Add native synchronous execution #564

Open
igorya7v opened this issue May 12, 2023 · 3 comments
Open

HTTP Service invocation: Add native synchronous execution #564

igorya7v opened this issue May 12, 2023 · 3 comments
Labels
help wanted Extra attention is needed
Milestone

Comments

@igorya7v
Copy link

When the loop is already running, the following line will raise the RuntimeError: This event loop is already running:

return loop.run_until_complete(awaitable)

This happens when the following line returns an already running loop:

loop = asyncio.get_running_loop()

@berndverst
Copy link
Member

This is too much work to fix for the upcoming release. Clearly calling the asynchronous implementation from a synchronous context isn't working for every situation.

Can you please call async def invoke_method_async instead?

@berndverst
Copy link
Member

We basically need synchronous method implementation of DaprHttpClient and then use that in the invoke_method implementation in DaprInvocationHttpClient. And we need additional tests for this.

@berndverst berndverst added the help wanted Extra attention is needed label May 31, 2023
@berndverst berndverst changed the title RuntimeError: This event loop is already running HTTP Service invocation: Add native synchronous execution May 31, 2023
@berndverst berndverst added this to the v1.11 milestone May 31, 2023
@berndverst
Copy link
Member

For the time being, please use the example shown here which uses Python requests directly for a basic service invocation call. As long as you set the dapr-app-id header and specify the sidecar address as destination, any path will be routed to the target app and invoked accordingly. There is no need to use the Python SDK.

https://github.com/dapr/quickstarts/blob/master/service_invocation/python/http/checkout/app.py

@berndverst berndverst modified the milestones: v1.11, v1.12 Aug 17, 2023
@berndverst berndverst modified the milestones: v1.12, v1.13 Oct 31, 2023
@berndverst berndverst modified the milestones: v1.13, v1.14 Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants