Browse Source

Adds Task.map + Task.starmap

Ask Solem 13 năm trước cách đây
mục cha
commit
57eb25ccc1
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      celery/app/task.py

+ 8 - 0
celery/app/task.py

@@ -715,6 +715,14 @@ class BaseTask(object):
         from celery import chunks
         return chunks(self.s(), it, n)
 
+    def map(self, it):
+        from celery import xmap
+        return xmap(self.s(), it)
+
+    def starmap(self, it):
+        from celery import xstarmap
+        return xstarmap(self.s(), it)
+
     def update_state(self, task_id=None, state=None, meta=None):
         """Update task state.