def status_handler(task_id): # status = nosetests.delay() #@UndefinedVariable task = MyAsyncResult(task_id) # @UndefinedVariable result = task.load_meta() offset = bottle.request.query.get('s') if offset and result and result.logs: last = int(offset) - (result.tip or 0) # it should be negative result.logs[:] = result.logs[last:] if last else [] value = task.result if task.successful() else None bottle.response.add_header('Cache-Control', 'no-cache') return dict(status=task.status, value=value, result=result, traceback=task.traceback)
def revoke_handler(task_id): """ Use this API to cancel a pending/running Shiraz job. Usage: http://shiraz/revoke/89a118cb-563b-4f7c-b548-d947f7069615 (where 89a118cb-563b-4f7c-b548-d947f7069615 is the Shiraz task ID, which you can get from the celery inspect active output, second to last field) """ LOG.info("REVOKE: called with task id: " + str(task_id)) task = MyAsyncResult(task_id) # @UndefinedVariable task.revoke(terminate=True) task.revoke(terminate=True) # XXX: why?! bottle.response.add_header('Cache-Control', 'no-cache') result = dict(status=task.status) LOG.info("REVOKE: Result: " + str(result)) return result
def revoke_handler(task_id): task = MyAsyncResult(task_id) # @UndefinedVariable task.revoke(terminate=True) task.revoke(terminate=True) # XXX: why?! bottle.response.add_header('Cache-Control', 'no-cache') return dict(status=task.status)