郭學聰 Hsueh-Tsung Kuo
Sun, 06 Sep 2020
Someone (who?) said:
a game programmer should be able to draw cute anime character(?)
digraph {
compound=true
rankdir=LR
graph [fontname="Source Sans Pro" fontsize=20]
node [fontname="Source Sans Pro" fontsize=18]
edge [fontname="Source Sans Pro" fontsize=12]
subgraph cluster_service {
label="service"
task_1 [label="task 1" shape=box]
task_2 [label="task 2" shape=box]
peroidic_task [label="periodic task" shape=box]
}
subgraph cluster_broker {
label="Celery broker (call, inspect)"
concentrate=true
amqp [label="RabbitMQ AMQP" shape=box]
}
subgraph cluster_backend {
label="Celery backend (result)"
concentrate=true
rpc [label="RabbitMQ RPC" shape=box]
}
subgraph cluster_worker {
label="Celery worker"
worker_1 [label="worker 1" shape=box]
worker_2 [label="worker 2" shape=box]
worker_3 [label="worker 3" shape=box]
}
task_1 -> amqp [color="blue"]
task_2 -> amqp [color="blue"]
peroidic_task -> amqp [color="blue"]
amqp -> worker_1 [color="blue"]
amqp -> worker_2 [color="blue"]
amqp -> worker_3 [color="blue"]
amqp -> worker_1 [color="pink" style="dashed" dir="both"]
amqp -> worker_2 [color="pink" style="dashed" dir="both"]
amqp -> worker_3 [color="pink" style="dashed" dir="both"]
rpc -> task_1 [color="red"]
rpc -> task_2 [color="red"]
rpc -> peroidic_task [color="red"]
worker_1 -> rpc [color="red"]
worker_2 -> rpc [color="red"]
worker_3 -> rpc [color="red"]
}
@app.task def my_task(arg1, arg2, kwarg1='a', kwarg2='b'): ... return result result = my_task.delay(arg1, arg2, kwarg1='x', kwarg2='y') result = my_task.apply_async(args=[arg1, arg2], kwargs={'kwarg1': 'x', 'kwarg2': 'y'}, countdown=60, expires=120) result.get()
Celery-Singleton
https://github.com/steinitzu/celery-singleton
Card Captor Sakura
Celery-controlled singleton
https://github.com/fieliapm/celery_controlled_singleton
i = celery_app.control.inspect(timeout=1.0) # collect response after 1.0 second i.active() # get active tasks # then find same tasks in active tasks
inspect.active()
: running tasksinspect.reserved()
: queued tasksinspect.scheduled()
: scheduled ETA tasks You cannot atomically inspect all of them
Celery-controlled singleton
https://github.com/fieliapm/celery_controlled_singleton
郭學聰 Hsueh-Tsung Kuo2020_09_06