auvipy / celery-flower

Under heavy development now: Real time Celery monitoring with ASGI 3.0 +
BSD 3-Clause "New" or "Revised" License
176 stars 36 forks source link

Reading task state with trailing slash produces 500 error #10

Closed jurecuhalev closed 13 years ago

jurecuhalev commented 13 years ago

Documentation states:

/api/task/$task_id/
Show task by UUID.

Reading task with: http://localhost:8989/api/task/181375c8-4b07-4867-9ec4-e2f887a95fc8 works, while http://localhost:8989/api/task/181375c8-4b07-4867-9ec4-e2f887a95fc8/ (with trailing slash, produces:

[2011-04-06 12:05:43,518: ERROR/MainProcess] Uncaught exception GET /api/task/181375c8-4b07-4867-9ec4-e2f887a95fc8/ (127.0.0.1)
HTTPRequest(protocol='http', host='localhost:8989', method='GET', uri='/api/task/181375c8-4b07-4867-9ec4-e2f887a95fc8/', version='HTTP/1.1', remote_ip='127.0.0.1', body='', headers={'Accept-Language': 'sl,en;q=0.8,en-US;q=0.6', 'Accept-Encoding': 'gzip,deflate,sdch', 'Host': 'localhost:8989', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_6) AppleWebKit/534.27 (KHTML, like Gecko) Chrome/12.0.712.0 Safari/534.27', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'Connection': 'keep-alive', 'Cookie': 'sessionid=e7968d29a5cedd1dad57a3f93cc88cc2; csrftoken=2b822098281561e75e896c4a061728c1'})
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/tornado/web.py", line 861, in _execute
    getattr(self, self.request.method.lower())(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/celerymonitor/handlers/api.py", line 16, in _write_json
    content = fun(self, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/celerymonitor/handlers/api.py", line 33, in get
    return fun(self, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/celerymonitor/handlers/api.py", line 40, in task_state
    task = state.tasks[task_id]
KeyError: '181375c8-4b07-4867-9ec4-e2f887a95fc8/'
[2011-04-06 12:05:43,519: ERROR/MainProcess] 500 GET /api/task/181375c8-4b07-4867-9ec4-e2f887a95fc8/ (127.0.0.1) 0.46ms
ask commented 13 years ago

Thanks!

I've merged this now