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
Symmetrical chaining futures in asyncio.future.wrap_future #78611
Comments
asyncio.future.wrap_future is used to wrap a concurrent.future.Future in a asyncio.future.Future. The actual implementation as the following behaviours :
I wonder why the futures synchronisation is not symmetrical ?
I have also posted a request pull that implements the proposed behaviours, in case of acceptation. If there is good reasons to not implement the proposed behaviours, I would be glad to know. Thank you ! |
Actually the PR does not pass some tests, I will work on this. If the new behaviours are accepted, I will implement them soon. |
The proposed solution (PR) has passed all tests. |
The PR needs a very careful review, but in general I'm OK with the idea. I'm also curious why do you want to fix wrap_future -- how are you using it? |
I use it to integrate a concurrent-based software (B) with an asyncio-based software (A). So (A) waits for a task request with an asyncio.Future, then processes it and populates the Future's result. When (B) receives a request it creates a concurrent.futures.Future and push it into a queue for the waiting loop. If the request asks for a task implemented by (A), it wraps it into an asyncio.Future and call (A) with it. Actually I will not need it for long, as (B) will become asyncio-based, but I wanted to integrate (A) and (B) with as less effort as possible, so I implemented my custom Future wrapper, but I think it is useful to refactor concurrent-based software to asyncio incrementally (and I will have to do it multiple times in the near future). |
Can be closed if not needed by the community. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: