Files
presentations/2026/celery/slides/03-progressbar-parallel.md
T
2026-04-10 15:50:19 +02:00

9.9 KiB

Accès concurrent

<script type="text/mermaid"> block columns 1 block:macro_task columns 6 space:2 macro_task_label["macro_task"]:2 space:2 s(("start")) w1["work"] u1["progress"] w2["work"] u2["progress"] e(("end")) s-->w1 w1-->u1 u1-->w2 w2-->u2 u2-->e end classDef transparent fill:none,stroke:none; class macro_task_label transparent </script>
<script type="text/mermaid"> --- config: theme: neutral --- block columns 1 block:macro_task columns 1 worker_label["worker"] block columns 1 w1_label["thread1"] w1["macro_task"] end block columns 1 w2_label["thread2"] w2["💤"] end block columns 1 w3_label["thread3"] w3["💤"] end end classDef transparent fill:none,stroke:none; classDef task fill:#ffffded9; class worker_label,w1_label,w2_label,w2,w3_label,w3 transparent class w1 task </script>

Accès concurrent

Cas parallèle

<script type="text/mermaid"> block columns 1 block:macro_task columns 3 macro_task_label["macro_task"]:3 space block:w1 columns 2 w1_label["micro_task"]:2 w1_["work"] u1["progress"] w1_-->u1 end space s(("start")) block:w2 columns 2 w2_label["micro_task"]:2 w2_["work"] u2["progress"] w2_-->u2 end e(("end")) space block:w3 columns 2 w3_label["micro_task"]:2 w3_["work"] u3["progress"] w3_-->u3 end end s-->w1 s-->w2 s-->w3 w1-->e w2-->e w3-->e classDef transparent fill:none,stroke:none; classDef lg fill:lightgray,stroke:none; class macro_task_label,w1_label,w2_label,w3_label,w4_label,w5_label,s_ transparent class w1,w2,w3,w4,w5 lg </script>
<script type="text/mermaid"> --- config: theme: neutral --- block columns 2 block:coordinator columns 1 c_worker_label["coordinator"] block columns 1 c_w1_label["thread1"] c_w1["macro_task"] end block columns 1 c_w2_label["thread2"] c_w2["💤"] end block columns 1 c_w3_label["thread3"] c_w3["💤"] end end block:executor columns 1 e_worker_label["executor"] block columns 1 e_w1_label["thread1"] e_w1["micro_task"] end block columns 1 e_w2_label["thread2"] e_w2["micro_task"] end block columns 1 e_w3_label["thread3"] e_w3["micro_task"] end end classDef transparent fill:none,stroke:none; classDef task fill:#ffffded9; class c_worker_label,c_w1_label,c_w2_label,c_w3_label,c_w2,c_w3 transparent class e_worker_label,e_w1_label,e_w2_label,e_w3_label transparent class c_w1 task </script>

Accès concurrent

Cas parallèle

<script type="text/mermaid"> flowchart LR micro_task_1[micro_task] micro_task_2[micro_task] macro_task micro_task_1-->|Get task progress|macro_task micro_task_2-->|Get task progress|macro_task </script>

Accès concurrent

Cas parallèle

<script type="text/mermaid"> flowchart RL micro_task_1[micro_task] micro_task_2[micro_task] macro_task-->|2/10|micro_task_1 macro_task-->|2/10|micro_task_2 </script>

Accès concurrent

Cas parallèle

<script type="text/mermaid"> flowchart LR micro_task_1[micro_task] micro_task_2[micro_task] micro_task_1-->|Set progress to 3/10|macro_task micro_task_2-->|Set progress to 3/10|macro_task </script>

Accès concurrent

Retour au séquentiel

<script type="text/mermaid"> --- config: theme: neutral --- block columns 3 block:coordinator columns 1 c_worker_label["coordinator"] block columns 1 c_w1_label["thread1"] c_w1["macro_task"] end block columns 1 c_w2_label["thread2"] c_w2["💤"] end block columns 1 c_w3_label["thread3"] c_w3["💤"] end end block:executor columns 1 e_worker_label["executor"] block columns 1 e_w1_label["thread1"] e_w1["micro_task"] end block columns 1 e_w2_label["thread2"] e_w2["micro_task"] end block columns 1 e_w3_label["thread3"] e_w3["micro_task"] end end block:d columns 1 d_worker_label["default"] block columns 1 d_w1_label["thread1"] d_w1["💤"] end space:2 end classDef transparent fill:none,stroke:none; classDef task fill:#ffffded9; class c_worker_label,c_w1_label,c_w2_label,c_w3_label,c_w2,c_w3 transparent class e_worker_label,e_w1_label,e_w2_label,e_w3_label transparent class d_worker_label,d_w1_label,d_w1 transparent class c_w1 task </script>
<script type="text/mermaid"> --- config: theme: forest --- block columns 1 block:queue columns 1 label["default queue"] space:6 end classDef transparent fill:none,stroke:none; classDef task fill:#eee,stroke:#999; class label,w1_label,w2_label,w2,w3_label,w3 transparent class w1 task </script>

Accès concurrent

Retour au séquentiel

<script type="text/mermaid"> --- config: theme: neutral --- block columns 3 block:coordinator columns 1 c_worker_label["coordinator"] block columns 1 c_w1_label["thread1"] c_w1["macro_task"] end block columns 1 c_w2_label["thread2"] c_w2["💤"] end block columns 1 c_w3_label["thread3"] c_w3["💤"] end end block:executor columns 1 e_worker_label["executor"] block columns 1 e_w1_label["thread1"] e_w1["micro_task"] end block columns 1 e_w2_label["thread2"] e_w2["💤"] end block columns 1 e_w3_label["thread3"] e_w3["💤"] end end block:d columns 1 d_worker_label["default"] block columns 1 d_w1_label["thread1"] d_w1["progress"] end space:2 end classDef transparent fill:none,stroke:none; classDef task fill:#ffffded9; class c_worker_label,c_w1_label,c_w2_label,c_w3_label,c_w2,c_w3 transparent class e_worker_label,e_w1_label,e_w2_label,e_w3_label,e_w2,e_w3 transparent class d_worker_label,d_w1_label transparent class c_w1 task </script>
<script type="text/mermaid"> --- config: theme: forest --- block columns 1 block:queue columns 1 label["default queue"] w1["progress"] space:5 end classDef transparent fill:none,stroke:none; classDef task fill:#eee,stroke:#999; class label,w1_label,w2_label,w2,w3_label,w3 transparent class w1 task </script>

Différences avec celery-progress

ptf-task celery-progress
Broker RabbitMQ ou Redis RabbitMQ ou Redis
Backend Celery events Channel Layers
Streaming Django StreamingHttpResponse Channel AsyncWebsocketConsumer
Protocol HTTP ou SSE HTTP ou WebSocket