I am trying to use the flower's http api to monitor the task state.
But it seems that the task state from the "/api/task/result/*" is incorrect (they never seem to be updated).
I only tested this in AMQP with rpc backend. On the other hand, values from "/api/tasks" are okay (what is displayed on the web page is also okay).
Here is a simple script that demonstrate the issue.
from celery import Celery
default_broker = 'pyamqp://guest@localhost//'
app = Celery('task_bug', broker=default_broker, backend='rpc://')
api_root = 'http://localhost:5555/api'
url_root = "http://localhost:5555"
@app.task()
def add(x, y):
return x + y
def task_state_from_api_task_result(r):
import requests, json
task_api = '{}/task'.format(api_root)
url = "{}/result/{}".format(task_api, r.task_id)
resp = requests.get(url)
return resp.json()["state"]
if __name__ == '__main__':
r = add.delay(3, 4)
import time
time.sleep(1)
assert r.state == "SUCCESS"
assert task_state_from_api_task_result(r) == "SUCCESS" # This raises an AssertionError
Here is my environment. I have tested flower 0.9.2 and the current master branch.
I am trying to use the flower's http api to monitor the task state. But it seems that the task state from the "/api/task/result/*" is incorrect (they never seem to be updated). I only tested this in AMQP with rpc backend. On the other hand, values from "/api/tasks" are okay (what is displayed on the web page is also okay).
Here is a simple script that demonstrate the issue.
Here is my environment. I have tested flower 0.9.2 and the current master branch.