[issue34430] Symmetrical chaining futures in asyncio.future.wrap_future

2019-04-03 Thread Alfred Sawaya


Alfred Sawaya  added the comment:

Can be closed if not needed by the community.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


New submission from Alfred Sawaya :

asyncio.future.wrap_future is used to wrap a concurrent.future.Future in a 
asyncio.future.Future. 

The actual implementation as the following behaviours : 

 1) When the concurrent.future.Future gets a result, the asyncio.future.Future 
gets the same result,
 2) When the asyncio.future.Future is cancelled, the concurrent.future.Future 
is cancelled

I wonder why the futures synchronisation is not symmetrical ?
I propose to add the following behaviours : 

 3) When the asyncio.future.Future gets a result, the concurrent.future.Future 
gets the same result,
 4) When the concurrent.future.Future is cancelled, the asyncio.future.Future 
is cancelled

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 !

--
components: asyncio
messages: 323703
nosy: asvetlov, huji, yselivanov
priority: normal
pull_requests: 8280
severity: normal
status: open
title: Double chaining futures in asyncio.future.wrap_future
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
pull_requests:  -8280

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
keywords: +patch
pull_requests: +8281
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
pull_requests:  -8281

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Alfred Sawaya  added the comment:

Actually the PR does not pass some tests, I will work on this. If the new 
behaviours are accepted, I will implement them soon.

--

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
pull_requests: +8283

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
pull_requests: +8284

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Alfred Sawaya  added the comment:

The proposed solution (PR) has passed all tests.

--

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
versions:  -Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Double chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
pull_requests:  -8283

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Symmetrical chaining futures in asyncio.future.wrap_future

2018-08-18 Thread Alfred Sawaya


Change by Alfred Sawaya :


--
title: Double chaining futures in asyncio.future.wrap_future -> Symmetrical 
chaining futures in asyncio.future.wrap_future

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34430] Symmetrical chaining futures in asyncio.future.wrap_future

2018-10-02 Thread Alfred Sawaya


Alfred Sawaya  added the comment:

I use it to integrate a concurrent-based software (B) with an asyncio-based 
software (A).
(B) will undergo a massive refactoring to become asyncio-based in the future, 
but for now, I need to use it as-is.
I don't want to modify (A) to handle concurrent.futures.Future (it is 
developped by another team by the way) and I prefer to begin to implement 
asyncio into (B).

So (A) waits for a task request with an asyncio.Future, then processes it and 
populates the Future's result.
(B) has a waiting loop into a thread that handles multiples 
concurrent.futures.Future.

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.
(A) processes the task and populates the asyncio.Future's result. That's why I 
needed to implement the proposed behaviours.

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).

--

___
Python tracker 
<https://bugs.python.org/issue34430>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com