def test_TaskSet_import_from_task_base(self): warnings.resetwarnings() with catch_warnings(record=True) as log: from celery.task.base import TaskSet, subtask TaskSet() subtask(PingTask) for w in (log[0].message, log[1].message): self.assertIsInstance(w, CDeprecationWarning) self.assertIn("is deprecated", w.args[0])
def dmap(fun, args, timeout=None): """Distribute processing of the arguments and collect the results. Example >>> from celery.task import dmap >>> import operator >>> dmap(operator.add, [[2, 2], [4, 4], [8, 8]]) [4, 8, 16] """ return TaskSet.map(fun, args, timeout=timeout)
def dmap_async(fun, args, timeout=None): """Distribute processing of the arguments and collect the results asynchronously. :returns: :class:`celery.result.AsyncResult` object. Example >>> from celery.task import dmap_async >>> import operator >>> presult = dmap_async(operator.add, [[2, 2], [4, 4], [8, 8]]) >>> presult <AsyncResult: 373550e8-b9a0-4666-bc61-ace01fa4f91d> >>> presult.status 'SUCCESS' >>> presult.result [4, 8, 16] """ return TaskSet.map_async(fun, args, timeout=timeout)
def block(log): from celery.task.base import TaskSet, subtask TaskSet() subtask(PingTask) return log[0].message, log[1].message