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

[Question] Olympe SDK support for AsyncIO #42

Open
alejandro-zuleta-globant opened this issue Feb 27, 2023 · 1 comment
Open

[Question] Olympe SDK support for AsyncIO #42

alejandro-zuleta-globant opened this issue Feb 27, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@alejandro-zuleta-globant

We are building a gRPC server using the gRPC AsyncIO API and we need to integrate Olympe for controlling a Parrot Drone from the gRPC services. Since it is strongly recommended not to perform blocking operations inside AsyncIO event loop, we need to control the drone through non-blocking operations in order to allow the event loop to execute any other coroutines that may be waiting to execute.

Does Olympe provide fully non-blocking operations?

@ndessart
Copy link
Member

Olympe expectation objects are awaitable objects in an olympe.concurrent.Loop event loop (not asyncio). To use olympe expectation objects in an asyncio event loop you'd need to wrap them with an asyncio.Future (example: expectation.add_done_callback(lambda e: loop.call_soon_threadsafe(lambda: fut.set_result(e.success()))) with 'loop' an asyncio loop and 'fut' a Future associated with this loop.).

See: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.call_soon_threadsafe

@ndessart ndessart added the enhancement New feature or request label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants