Status of the Task PENDING #7161
Replies: 4 comments
-
Hey @premanandaembed 👋, We also offer priority support for our sponsors. |
Beta Was this translation helpful? Give feedback.
-
it is urgent to me please help me. |
Beta Was this translation helpful? Give feedback.
-
I see your using Windows... |
Beta Was this translation helpful? Give feedback.
-
closing for not following any templates. beside you can start with discussion firts |
Beta Was this translation helpful? Give feedback.
-
i'm using Window 11 and windows redis exe redis-2.4.5-win32-win64 64bit folder i'm getting task id but i'm always getting state value as PENDING what will be reason.
app.py file as:
from celery import Celery
from flask import Flask
app = Flask(name)
simple_app = Celery('simple_worker', broker='redis://127.0.0.1:6379/0', backend='redis://127.0.0.1:6379/0')
simple_app.conf.CELERY_TASK_TRACK_STARTED = True
@app.route('/simple_start_task')
def call_method():
app.logger.info("Invoking Method ")
# queue name in task folder.function name
r = simple_app.send_task('tasks.longtime_add', kwargs={'x': 1, 'y': 2})
app.logger.info(r.backend)
print(simple_app.conf["CELERY_IGNORE_RESULT"])
return r.id
@app.route('/simple_task_status/<task_id>')
def get_status(task_id):
status = simple_app.AsyncResult(task_id, app=simple_app)
print("Invoking Method ")
return "Status of the Task " + str(status.state)
@app.route('/simple_task_result/<task_id>')
def task_result(task_id):
result = simple_app.AsyncResult(task_id).result
return "Result of the Task " + str(result)
if name == 'main':
app.run(host="127.0.0.1", port=5555)
tasks.py file as:
from celery.utils.log import get_task_logger
logger = get_task_logger(name)
app = Celery('tasks', broker='redis://127.0.0.1:6379/0', backend='redis://127.0.0.1:6379/0')
app.conf.CELERY_TASK_TRACK_STARTED = True
@app.task()
def longtime_add(x, y):
logger.info('Got Request - Starting work ')
time.sleep(4)
logger.info('Work Finished ')
return x + y
let me know what wrong with two file.
Beta Was this translation helpful? Give feedback.
All reactions