Flatten doesn't work with DaskStream
See original GitHub issueThis code:
from __future__ import division, print_function
from time import sleep
from streamz import Stream
from dask.distributed import Client
client = Client()
def callback(datas):
print(':',datas)
return datas
source = Stream().scatter()
stream = source.partition(5)
stream = stream.map(callback)
stream = stream.flatten()
stream.buffer(15).gather().sink(print)
for i in range(30):
source.emit(i)
returns:
Traceback (most recent call last):
File "test.py", line 21, in <module>
: (0, 1, 2, 3, 4)
source.emit(i)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 332, in emit
sync(self.loop, _)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 1277, in sync
six.reraise(*error[0])
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 1262, in f
result[0] = yield future
File "/home/klinger/rossum/local/lib/python2.7/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/home/klinger/rossum/local/lib/python2.7/site-packages/tornado/concurrent.py", line 260, in result
raise_exc_info(self._exc_info)
File "/home/klinger/rossum/local/lib/python2.7/site-packages/tornado/gen.py", line 315, in wrapper
yielded = next(result)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 327, in _
result = yield self._emit(x)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 298, in _emit
r = downstream.update(x, who=self)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 734, in update
return self._emit(tuple(result))
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 298, in _emit
r = downstream.update(x, who=self)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/dask.py", line 58, in update
return self._emit(result)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 298, in _emit
r = downstream.update(x, who=self)
File "/home/klinger/years/2014/projects/devel/streamz/streamz/core.py", line 1020, in update
for item in x:
TypeError: 'Future' object is not iterable
Without dask interface (removing scatter and gather), everything works well.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
how to use flatten layer? (it does not flatten arrays) #1525
hello, I'm playing with the MNIST dataset, and surprise: the flatten layer does not flatten array here an example: julia> using Flux ...
Read more >python - np.ndarray.flatten does not flatten - Stack Overflow
Try using np.stack to flatten the object dtype layering. – hpaulj. May 17, 2018 at 18:15.
Read more >Flatten an Array with NumPy flatten - Datagy
Why doesn't NumPy flatten work? The NumPy flatten method doesn't modify an array, but rather returns a copy of the array.
Read more >Flatten Command doesn't work after update to AutoCAD for ...
Solved: Hello, I recently downloaded autocad2017.3 and the flatten command is not working. Please help john.vellek has edited your subject ...
Read more >Flatten a NumPy array with ravel() and flatten() - nkmk note
You can flatten a NumPy array ndarray with the numpy.label() function, or the ravel() and ... Note that it doesn't work on Python...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Problems:
DaskStream
is missing specificflatten()
, so coreStream.flatten()
is used. It produces core streams instead of dask streams.flatten
toDaskStream
(same way as for partition), it may get different values:partition
before it - it can process it wellThanks a lot this was very helpful.