You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flyyabelle
changed the title
use rpc as celery backend, always get PENDING result
use rpc as celery backend, always get PENDING result celery version 4.41
Jun 27, 2024
celery config:
RMQ = CONFIG['rabbitmq']
broker = 'amqp://{}:{}@{}:{}/{}'.format(RMQ['user'], urlquote(RMQ['password']), RMQ['host'], RMQ['port'], RMQ['vhost'])
app = Celery('iris',
broker=broker,
backend='rpc://',
include=[
'dialog.taskmgr.clear_temporary_file',
'dialog.taskmgr.download_detail_task',
'dialog.taskmgr.business_statistic',
'dialog,taskmgr.tasks'
])
app.conf.update(
result_backend_transport_options={
'visibility_timeout': 3600, # 1 hour
'polling_interval': 2.0 # 2 seconds
},
timezone='Asia/Shanghai',
enable_utc=False
)
@app.task
def add(x, y):
return x y
result = add.apply_async([2, 3])
print(result.id) # 7421ec0a-f4c1-4ed1-af46-aad4020ae575
print(result.get()) # 获取任务结果 ok
print(result.status) # 检查任务状态 # SUCCESS
print(add.AsyncResult(result.id).state) # PENDING
print(add.AsyncResult(result.id).status) # PENDING
The text was updated successfully, but these errors were encountered: