python - Can anybody explain me how celery group worked? -
when use celery group , chains schedule tasks below
(group([group_task]) | sum_task).apply_async()
the group tasks can executed in many workers, after group tasks finished, sum_task begin execute(maybe in other worker), can tell me how celery known group tasks finished , started sum_task?
you specify queue each chained task , group/chord callback task differently.
snippet like:
@shared_task(name="analyze_atom", queue="atom") def analyze_atom(image_urls, targetdir=target_path, studentuid=none): return {} @shared_task(name="summary_up", queue="summary") def summary_up(rets, studentuid, images): return {} chord(analyze_atom.s([image]) image in images)(summary_up.s(studentuid, images))
and, when tasks running, inspect broker content, assume using rabbitmq broker, inspect queue depth rabbitmq management plugin, or pyrabbit interface snippet here:
from pyrabbit.api import client cl = client('localhost:15672', 'guest', 'guest') count = cl.get_queue_depth('/', 'summary') # guy check queue depth cl.get_messages('/','paperanalyzer') # guy messages within queue
and, should have result backend, every task result task id.
i think upon skills above, it's easy inspect how celery task goes on.
good luck :-)
Comments
Post a Comment