Monday 15 February 2010

python - Is it possible to suspend a Celery beat task but have other beat tasks still work? -



python - Is it possible to suspend a Celery beat task but have other beat tasks still work? -

celery_app.conf.update( celerybeat_schedule = { 'taska': { 'task': 'crawlerapp.tasks.manual_crawler_update', 'schedule': timedelta(seconds=3600), }, 'taskb': { 'task': 'crawlerapp.tasks.auto_crawler_update_day', 'schedule': timedelta(seconds=3600), }, 'taskc': { 'task': 'crawlerapp.tasks.auto_crawler_update_hour', 'schedule': timedelta(seconds=3600), }, })

there 3 beat tasks in application. when beat tasks run, utilize flower manage tasks.

when find there bug in 1 task, must stop whole task modify bug. restart celery.

is possible stop 1 task , allow other tasks go on running?

yes, possible. 1 way queue 3 tasks in different queues , have different workers run tasks.

by whenever have problem task, can stop corresponding worker. prepare issue , run worker again. other 2 workers executing tasks usual.

for example, schedule periodic task this

from celery.decorators import periodic_task celery.schedules import crontab @periodic_task(run_every=crontab(minute=0, hour='*/1'), queue='q1', options={'queue': 'q1'}) def taska(): #do

and start worker

celery -a your_app worker -l info -q q1 -b

python task celery celerybeat

No comments:

Post a Comment