Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions streamz/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,18 @@ class Stream(object):

def __init__(self, upstream=None, upstreams=None, stream_name=None,
loop=None, asynchronous=None, ensure_io_loop=False):
from .dask import DaskStream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a dependency on Dask?


self.downstreams = OrderedWeakrefSet()
if upstreams is not None:
self.upstreams = list(upstreams)
else:
self.upstreams = [upstream]
if upstreams:
if (all(isinstance(u, DaskStream) for u in upstreams) !=
any(isinstance(u, DaskStream) for u in upstreams)):
raise ValueError('Must combine only DaskStreams '
'or no DaskStreams')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there no valid use cases of doing this?


self._set_asynchronous(asynchronous)
self._set_loop(loop)
Expand Down
9 changes: 9 additions & 0 deletions streamz/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,12 @@ def add(x, y, z=0):
yield source.emit((i, i))

assert L == [10, 12, 14, 16, 18]


def test_dask_not_dask():
with cluster() as (s, [a, b]):
with Client(s['address']):
s = Stream()
s2 = s.scatter()
with pytest.raises(ValueError):
s.zip(s2)