MCPcopy
hub / github.com/celery/celery / create_canvas

Function create_canvas

examples/stamping/revoke_example.py:10–19  ·  view source on GitHub ↗

Creates a canvas to calculate: n * sum(1..n) * 10 For example, if n = 3, the result is 3 * (1 + 2 + 3) * 10 = 180

(n: int)

Source from the content-addressed store, hash-verified

8
9
10def create_canvas(n: int) -> Signature:
11 """Creates a canvas to calculate: n * sum(1..n) * 10
12 For example, if n = 3, the result is 3 * (1 + 2 + 3) * 10 = 180
13 """
14 canvas = chain(
15 group(identity_task.s(i) for i in range(1, n+1)) | xsum.s(),
16 chord(group(mul.s(10) for _ in range(1, n+1)), xsum.s()),
17 )
18
19 return canvas
20
21
22def revoke_by_headers(result: AsyncResult, terminate: bool) -> None:

Callers 1

prepare_workflowFunction · 0.85

Calls 4

chainClass · 0.90
groupClass · 0.90
chordFunction · 0.85
sMethod · 0.45

Tested by

no test coverage detected