Skip to content

Commit

Permalink
MIN Explicit check against iterating Task
Browse files Browse the repository at this point in the history
This is a possible cause of user error.
  • Loading branch information
luispedro committed Feb 22, 2017
1 parent 7ffbaea commit 83eb07f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jug/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ class TaskletMixin(object):
def __getitem__(self, slice):
return Tasklet(self, _getitem(slice))

def __iter__(self):
raise NotImplementedError("""\
You cannot iterate over Task results.
If the Task returns an iterator of a fixed size, `iteratetask` may fit your usage:
http://jug.readthedocs.io/en/latest/api.html?highlight=iteratetask#jug.iteratetask""")

class Task(TaskletMixin):
'''
T = Task(f, dep0, dep1,..., kw_arg0=kw_val0, kw_arg1=kw_val1, ...)
Expand Down

0 comments on commit 83eb07f

Please sign in to comment.