--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
I would push lightly for deprecating callbacks later than sooner, because they are not the worst crutch for people who haven't wrapped their heads around promises (yet). For someone coming from JavaScript especially, who already groks async but is bad at python, callbacks are a familiar interface.
--
The tornado 5.0 will be for give up python2.7?
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
On 12/06/17 10:19, Ben Darnell wrote:
> On Sun, Jun 11, 2017 at 7:26 PM Sam carman <pypsuit...@gmail.com
> <mailto:pypsuit...@gmail.com>> wrote:
>
> The tornado 5.0 will be for give up python2.7?
>
>
> No, Tornado 5.0 will continue to support Python 2.7. One of my goals for
> this release is to provide a clean migration path for applications
> running on Tornado on Python 2.7 to Tornado+asyncio on Python 3.
Out of interest, is there a planned sunset date for support of Python 2.7?
Python 3.2 is nearly useless for compatibility with 2.7 code, and I'm
holding out until these devices are eventually updated to something
newer. Naturally though, I need to make a business case for that. :-)
On Sat, 10 Jun 2017 17:27:42 +0000
Ben Darnell <b...@bendarnell.com> wrote:
> As we discussed previously (in this thread:
> https://groups.google.com/d/msg/python-tornado/uqf0DjxILHc/aMSC0481DwAJ),
> I'm working on improving integration between Tornado and asyncio for 5.0.
> This initially involved two major changes:
>
> 1. IOLoop uses the asyncio event loop by default when asyncio is available
> 2. Native (async def) coroutines use the asyncio task runner instead of
> tornado.gen.coroutine
I gave it a quick run on Dask distributed
(https://github.com/dask/distributed/). From the start it's hitting two
pain points that we'll need to work around:
- the loop object doesn't have a `_running` attribute anymore (granted,
this was a private attribute)
- `PeriodicCallback` lost its `io_loop` argument
The latter could be solved by shipping our own PeriodicCallback
implementation.
The former will be trickier to solve.
Regards
Antoine.
On Sat, Jun 10, 2017 at 7:27 PM, Ben Darnell <b...@bendarnell.com> wrote:
As we discussed previously (in this thread: https://groups.google.com/d/msg/python-tornado/uqf0DjxILHc/aMSC0481DwAJ), I'm working on improving integration between Tornado and asyncio for 5.0. This initially involved two major changes:1. IOLoop uses the asyncio event loop by default when asyncio is available2. Native (async def) coroutines use the asyncio task runner instead of tornado.gen.coroutineThe first part, using the asyncio event loop by default, is done on the master branch now. This involved some changes to the instance() and current() methods to make them match asyncio.get_event_loop() (instance() is now deprecated). This may break some applications that depended on instance() to access the global singleton, but I expect most applications to be fine with this change. For now, it is possible to opt out of the asyncio-by-default change with `IOLoop.configure('tornado.ioloop.PollIOLoop')` (but keep reading).The coroutine integration is trickier. The first obstacle has to do with the two types tornado.concurrent.Future and asyncio.Future. The asyncio task runner doesn't understand anything but asyncio's own Future class, so we must convert between the two often (which is hard to do efficiently, especially since both classes have magic in their destructors to detect when they go unused). It might be better just use asyncio.Future everywhere (when available). This involves several small changes to things like the timing of callbacks, and one big one: asyncio Futures require an asyncio event loop at construction time, and that event loop must be running when they resolve (I consider this a design flaw in asyncio, but it's too late now). We can make this work, but only if we remove support for other event loops from python 3 completely, and require that asyncio be used whenever it is present (this will be disruptive to pyzmq). I think this is probably the right move but I'm still working through some of the edge cases here.
FWIW, I’ve given up on waiting for level-triggered FDs from libzmq, and am working on removing the need for injecting zmq_poll from pyzmq, so hopefully pyzmq 17 won’t be affected by these changes and should be able to sit on any asyncio/tornado implementation. (this is partly motivated by your 5.0 plans, so thanks for keeping us updated!).
The other big question has to do with stack_context and legacy callback-based interfaces. The asyncio task runner doesn't know anything about this, so stack_contexts will not be in effect during native coroutines. This doesn't make any difference for ExceptionStackContext, but it would prevent other (thread-local-like) uses. I considered ripping out stack_context completely for this release, but I think there's still probably enough people out there depending on it (often without realizing it! the failure mode of removing stack_context would be subtle) that it's not a good idea. However, to move towards a stack_context-free future (which will improve performance), I'll be deprecating the `callback` arguments throughout the codebase in favor of coroutine-style usage.-Ben
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
Yeah usually error handling in JS is extremely tedious (if done at all, especially in the browser), and this is one of the most compelling reasons to start using promises. The stack trace for a callback would begin with the callback function, without any real context on where it was called from.The status quo for error handling is so much worse than Python.
On Sun, Jun 11, 2017 at 10:28 AM, Ben Darnell <b...@bendarnell.com> wrote:On Sat, Jun 10, 2017 at 11:02 PM Japhy Bartlett <ja...@pearachute.com> wrote:I would push lightly for deprecating callbacks later than sooner, because they are not the worst crutch for people who haven't wrapped their heads around promises (yet). For someone coming from JavaScript especially, who already groks async but is bad at python, callbacks are a familiar interface.The rise of javascript and increasing familiarity with callback-based programming is, I think, the best argument for preserving the callback-based interfaces. This raises a question: Javascript doesn't have anything like stack_context (as far as I know), so how do people handle errors there? Do you just have to put a try/catch in all your callbacks and propagate errors manually? Or is there some other javascript-inspired error-handling idiom we could provide for callbacks that would be less invasive than stack_context?-Ben--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.