Questions tagged [celery-task]

celery-task is a building block of Celery distributed task queue system

celery-task is a building block of Celery distributed task queue system. Basically, it is a python class, but it can be created out of any callable by @celery.task decorator.

727 questions
6
votes
1 answer

Celery: it ignores the exchange name when sending a task

I have a very simple code: celery = Celery(broker="amqp://guest:guest@172.17.0.1:5672/") …
allan.simon
  • 3,886
  • 6
  • 35
  • 60
6
votes
3 answers

Celery - How to update the state of a task after the worker's being shutdown?

Setup Celery 3.0 broker=RabbitMQ Scenario Tasks have already been acknowledged and started processing, and have state=STARTED. Then I want to restart my worker (to update the worker to a newer version). After restart worker (using supervisorctl…
AnnieFromTaiwan
  • 3,845
  • 3
  • 22
  • 38
6
votes
3 answers

How to wait for results from a celery task in Django

I have a celery task which sends data to another service. I have added the celery task send_inventory_request into RequestSupplyStock class based view. when I make a post I should first get results from celery task and then continue and return a…
Philip Mutua
  • 6,016
  • 12
  • 41
  • 84
6
votes
2 answers

Retry a task in celery by task id

I've launched a lot of tasks, but some of then hasn't finished (763 tasks), are in a PENDING state, but the system isn't processing anything... It's possible to retry this tasks giving celery the task_id?
Antonio Beamud
  • 2,281
  • 1
  • 15
  • 26
6
votes
1 answer

Cannot use SQLite as backend in Celery

I have a simple project which is without any framework such as Django or Flask. My config is such: CELERY_BROKER_BACKEND = "sqlakombu.transport.Transport" CELERY_BROKER_URL = "db+sqlite:///results.sqlite" CELERY_CACHE_BACKEND =…
cem
  • 1,535
  • 19
  • 25
6
votes
1 answer

Celery Tasks on Django Models

I'm trying to learn how to use celery to check a date every day on one of my models. One of my models holds an expiration date and a boolean field that says whether their insurance is expired or not. The model is pretty big so I'm going to post a…
Kris Tryber
  • 227
  • 1
  • 8
  • 21
6
votes
1 answer

Celery Process 'Worker' exited with 'exitcode 1'

celery worker (part of Flask app) is getting killed before starting: Celery config parameters(Windows, Celery 3.1.25, Rabbitmq(latest)) flask_app = Flask(__name__) flask_app.secret_key = 'some_secret' flask_app.config['CELERY_BROKER_URL'] =…
Artem Kan
  • 61
  • 1
  • 2
6
votes
1 answer

Celery task display name

I have some Celery tasks and I'm checking their states periodically from a separate process by instantiating an AsyncResult using the task id. From this, I get the task state. By implementing a custom results backend and extended AsyncResult class…
John B
  • 3,391
  • 5
  • 33
  • 29
6
votes
2 answers

Celery - bulk queue tasks

I have some code that queues a large number (1000s) of celery tasks, for example's sake let's say it's this: for x in xrange(2000): example_task.delay(x) Is there a better/more efficient way of queuing a large number of tasks at once? They all…
J. Doe
  • 555
  • 1
  • 6
  • 15
6
votes
1 answer

Check if in celery task

How to check that a function in executed by celery? def notification(): # in_celery() returns True if called from celery_test(), # False if called from not_celery_test() if in_celery(): # Send mail directly…
Peter Petrik
  • 9,701
  • 5
  • 41
  • 65
6
votes
1 answer

Flask celery tasks not working

I configured my project, referring to this answer: How to use Flask-SQLAlchemy in a Celery task My extension.py file: import flask from flask.ext.sqlalchemy import SQLAlchemy from config import BaseConfig from celery import Celery from flask_mail…
Arti
  • 7,356
  • 12
  • 57
  • 122
6
votes
3 answers

Celery + Django Signals

I am trying to leverage the post_save function of Django Signals in combination with Celery tasks. After a new Message object is saved to the database, I want to evaluate if the instance has one of two attributes and if it does, call the…
Joe Fusaro
  • 847
  • 2
  • 11
  • 23
6
votes
1 answer

Share a common utility function between Celery tasks

I' ve got a bunch of tasks in Celery all connected using a canvas chain. @shared_task(bind=True) def my_task_A(self): try: logger.debug('running task A') do something except Exception: run common cleanup…
stratis
  • 7,750
  • 13
  • 53
  • 94
6
votes
2 answers

How to call a celery task delay function from non-python languages such as Java?

I have setup celery + rabbitmq for on a 3 cluster machine. I have also created a task which generates a regular expression based on data from the file and uses the information to parse text. from celery import Celery celery = Celery('tasks',…
Amit Gupta
  • 451
  • 5
  • 18
5
votes
2 answers

Celery - Check if worker received SIGTERM

I have a Celery task that is quite long. More than a few minutes. Sometimes, for various reasons, a worker is marked for termination and another worker starts. This can happen if the machine it runs on needs to be replaced, or a new code version is…
user972014
  • 3,296
  • 6
  • 49
  • 89