示例#1
0
    def test_chord_tasks(self):
        sigs = [celery_canvas.Signature() for r in range(4)]
        barrier = celery_canvas.Signature()

        chord = celery_canvas.chord(sigs, barrier)

        body, tasks = inspect.get_chord_tasks(chord)
        assert tasks == sigs
        assert body == barrier
示例#2
0
    def some_sigs(self):
        sigs = [
            celery_canvas.Signature(task_id='task-{}'.format(r))
            for r in range(10)
        ]

        for sig in sigs:
            sig.freeze()
        return sigs
示例#3
0
 def __call__(self, *args: Any, **kwargs: Any) -> str:
     self.func(*args, **kwargs)
     s = canvas.Signature(args=args,
                          kwargs=kwargs,
                          task=self.name,
                          app=self.app,
                          task_type=self.app.Task,
                          routing_key=self.name)
     result: AsyncResult = s.apply_async()
     return result.id
示例#4
0
 def test_add_celery_signature(self):
     wf = Workflow()
     sig = celery_canvas.Signature()
     res = wf.add_celery_signature(sig)
     node = res[0]
     assert node.id == sig.id
示例#5
0
 def test_signature_freeze(self):
     # perhaps this isn't the best place for this test,
     # it verifies whether freeze() still works as expected - assignes id
     sig = celery_canvas.Signature()
     sig.freeze()
     assert sig.id
示例#6
0
 def test_group_tasks(self):
     sigs = [celery_canvas.Signature() for r in range(4)]
     group = celery_canvas.group(sigs)
     tasks = inspect.get_group_tasks(group)
     assert tasks == sigs
示例#7
0
    def test_chain_tasks(self):
        sigs = [celery_canvas.Signature() for r in range(4)]

        chain = celery_canvas.chain(sigs)
        tasks = inspect.get_chain_tasks(chain)
        assert sigs == tasks