Problem with `timed_window` with asyncio
Hi,
When I try to use the timed_window function with the asyncio event loop I get the following error:
AttributeError: 'AsyncIOMainLoop' object has no attribute '_running'
For example if you change line 12 of the `fib_asyncio.py" example to:
s.timed_window(1.0).sink(lambda x: print(x))
then I get:
$ python fib_asyncio.py
Traceback (most recent call last):
File "fib_asyncio.py", line 14, in <module>
source.emit(0) # seed with initial values
File "/opt/venv-numismatic/lib/python3.6/site-packages/streamz/core.py", line 219, in emit
return sync(self.loop, _)
File "/opt/venv-numismatic/lib/python3.6/site-packages/streamz/core.py", line 1068, in sync
if not loop._running:
AttributeError: 'AsyncIOMainLoop' object has no attribute '_running'
Yeah, that's a bug. The check on IOLoop._running is Tornado-specific. Fortunately, that check is also a historical artifact, and can be removed without a problem. @snth do you have any interest in submitting a PR that removes this conditional block and perhaps also includes a small test? We should have some asyncio tests.
@mrocklin Could you describe why it is safe to remove those checks? I didn't look at more than 2 or 3 lines around the line that caused the problem so don't understand the overall context and how that code integrates into the bigger picture.
They aren't used within this project. The utility sync function was pulled from Dask, where that functionality was previously needed. It has no effect in this project.