|
@@ -88,9 +88,17 @@ class BaseAsyncResult(object):
|
|
"""``str(self)`` -> ``self.task_id``"""
|
|
"""``str(self)`` -> ``self.task_id``"""
|
|
return self.task_id
|
|
return self.task_id
|
|
|
|
|
|
|
|
+ def __hash__(self):
|
|
|
|
+ return hash(self.task_id)
|
|
|
|
+
|
|
def __repr__(self):
|
|
def __repr__(self):
|
|
return "<AsyncResult: %s>" % self.task_id
|
|
return "<AsyncResult: %s>" % self.task_id
|
|
|
|
|
|
|
|
+ def __eq__(self, other):
|
|
|
|
+ if isinstance(other, self.__class__):
|
|
|
|
+ return self.task_id == other.task_id
|
|
|
|
+ return self == other
|
|
|
|
+
|
|
@property
|
|
@property
|
|
def result(self):
|
|
def result(self):
|
|
"""When the task has been executed, this contains the return value.
|
|
"""When the task has been executed, this contains the return value.
|
|
@@ -134,6 +142,7 @@ class BaseAsyncResult(object):
|
|
return self.backend.get_status(self.task_id)
|
|
return self.backend.get_status(self.task_id)
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
class AsyncResult(BaseAsyncResult):
|
|
class AsyncResult(BaseAsyncResult):
|
|
"""Pending task result using the default backend.
|
|
"""Pending task result using the default backend.
|
|
|
|
|
|
@@ -312,7 +321,7 @@ class TaskSetResult(object):
|
|
>>> result = TaskSetResult.restore(task_id)
|
|
>>> result = TaskSetResult.restore(task_id)
|
|
|
|
|
|
"""
|
|
"""
|
|
- backend.store_taskset(taskset_id, result)
|
|
|
|
|
|
+ backend.store_taskset(self.taskset_id, self)
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def restore(self, taskset_id, backend=default_backend):
|
|
def restore(self, taskset_id, backend=default_backend):
|