celerybeat

Celery beat with method tasks not working

寵の児 提交于 2019-12-01 11:04:16
I'm trying to run celerybeat on a method task, and can't get anything to work out properly. Here's an example setup: from celery.contrib.methods import task_method from celery import Celery, current_app celery=celery('tasks', broker='amqp://guest@localhost//') celery.config_from_object("celeryconfig") class X(object): @celery.task(filter=task_method, name="X.ppp") def ppp(self): print "ppp" and my celeryconfig.py file is from datetime import timedelta CELERYBEAT_SCHEDULE = { 'test' : { 'task' : 'X.ppp', 'schedule' : timedelta(seconds=5) }, } When I run celery beat , I'm getting errors like:

Celery beat with method tasks not working

丶灬走出姿态 提交于 2019-12-01 08:35:31
问题 I'm trying to run celerybeat on a method task, and can't get anything to work out properly. Here's an example setup: from celery.contrib.methods import task_method from celery import Celery, current_app celery=celery('tasks', broker='amqp://guest@localhost//') celery.config_from_object("celeryconfig") class X(object): @celery.task(filter=task_method, name="X.ppp") def ppp(self): print "ppp" and my celeryconfig.py file is from datetime import timedelta CELERYBEAT_SCHEDULE = { 'test' : { 'task'

Setting up periodic tasks in Celery (celerybeat) dynamically using add_periodic_task

六月ゝ 毕业季﹏ 提交于 2019-11-30 13:03:17
I'm using Celery 4.0.1 with Django 1.10 and I have troubles scheduling tasks (running a task works fine). Here is the celery configuration: os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings') app = Celery('myapp') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) app.conf.BROKER_URL = 'amqp://{}:{}@{}'.format(settings.AMQP_USER, settings.AMQP_PASSWORD, settings.AMQP_HOST) app.conf.CELERY_DEFAULT_EXCHANGE = 'myapp.celery' app.conf.CELERY_DEFAULT_QUEUE = 'myapp.celery_default' app.conf.CELERY_TASK_SERIALIZER = 'json' app.conf.CELERY_ACCEPT_CONTENT = ['json'] app.conf.CELERY

Setting up periodic tasks in Celery (celerybeat) dynamically using add_periodic_task

人盡茶涼 提交于 2019-11-29 18:50:25
问题 I'm using Celery 4.0.1 with Django 1.10 and I have troubles scheduling tasks (running a task works fine). Here is the celery configuration: os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings') app = Celery('myapp') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) app.conf.BROKER_URL = 'amqp://{}:{}@{}'.format(settings.AMQP_USER, settings.AMQP_PASSWORD, settings.AMQP_HOST) app.conf.CELERY_DEFAULT_EXCHANGE = 'myapp.celery' app.conf.CELERY_DEFAULT_QUEUE = 'myapp.celery

In celery 3.1, making django periodic task

谁说我不能喝 提交于 2019-11-28 15:59:47
Things changed too much in Django, so I can't use 3.1. I need some help. I read about make a task in django , and read Periodic Tasks document. But I don't know how make periodic tasks in django. I think this becuase of my low level English.. In the older version of Celery, I imported djcelery & crontab and set CELERYBEAT_SCHEDULE in settings.py , and excuted by manage.py . But it seems that I cannot execute celery deamon by that way anymore. Than where I should put CELERYBEAT_SCHEDULE? In django example in docs, they set os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings') in proj

In celery 3.1, making django periodic task

可紊 提交于 2019-11-27 19:51:11
问题 Things changed too much in Django, so I can't use 3.1. I need some help. I read about make a task in django, and read Periodic Tasks document. But I don't know how make periodic tasks in django. I think this becuase of my low level English.. In the older version of Celery, I imported djcelery & crontab and set CELERYBEAT_SCHEDULE in settings.py , and excuted by manage.py . But it seems that I cannot execute celery deamon by that way anymore. Than where I should put CELERYBEAT_SCHEDULE? In

Celery stop execution of a chain

坚强是说给别人听的谎言 提交于 2019-11-27 11:49:58
问题 I have a check_orders task that's executed periodically. It makes a group of tasks so that I can time how long executing the tasks took, and perform something when they're all done (this is the purpose of res.join [1] and grouped_subs) The tasks that are grouped are pairs of chained tasks. What I want is for when the first task doesn't meet a condition (fails) don't execute the second task in the chain. I can't figure this out for the life of me and I feel this is pretty basic functionality

How to dynamically add / remove periodic tasks to Celery (celerybeat)

你。 提交于 2019-11-26 03:51:56
问题 If I have a function defined as follows: def add(x,y): return x+y Is there a way to dynamically add this function as a celery PeriodicTask and kick it off at runtime? I\'d like to be able to do something like (pseudocode): some_unique_task_id = celery.beat.schedule_task(add, run_every=crontab(minute=\"*/30\")) celery.beat.start(some_unique_task_id) I would also want to stop or remove that task dynamically with something like (pseudocode): celery.beat.remove_task(some_unique_task_id) or celery