How to run celery on windows?

Celery 4.0+ does not officially support window already. But it still works on window for some development/test purpose. Use eventlet instead as below: pip install eventlet celery -A <module> worker -l info -P eventlet It works for me on window 10 + celery 4.1 + python 3. This solution solved the following exception: [2017-11-16 21:19:46,938: … Read more

How do I use the @shared_task decorator for class based tasks?

Quoting Ask from celery-users thread where he explained difference between @task a @shared_task. Here is link to the thread TL;DR; @shared_task will create the independent instance of the task for each app, making task reusable. There is a difference between @task(shared=True) and @shared_task The task decorator will share tasks between apps by default so that … Read more

How to use Flask-SQLAlchemy in a Celery task

Update: We’ve since started using a better way to handle application teardown and set up on a per-task basis, based on the pattern described in the more recent flask documentation. extensions.py import flask from flask.ext.sqlalchemy import SQLAlchemy from celery import Celery class FlaskCelery(Celery): def __init__(self, *args, **kwargs): super(FlaskCelery, self).__init__(*args, **kwargs) self.patch_task() if ‘app’ in kwargs: … Read more

Python task queue alternatives and frameworks [closed]

I wrote Dramatiq specifically because of my increasing frustration with Celery having used it professionally for years. Check out the motivation page the “why” and a feature comparison between Dramatiq, Celery and RQ. Some highlights: actively developed and used in production great docs automatic retries code auto-reload locks and rate limiting redis and rabbitmq support

Find out whether celery task exists

Celery does not write a state when the task is sent, this is partly an optimization (see the documentation). If you really need it, it’s simple to add: from celery import current_app # `after_task_publish` is available in celery 3.1+ # for older versions use the deprecated `task_sent` signal from celery.signals import after_task_publish # when using … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)