@bp.route('/status/<task_id>')
@api.apimethod(MozharnessArchiveTask, unicode)
def task_status(task_id):
    "\n    Check and return the current state of the create_and_upload_archive celery task with task id\n    of <task_id>.\n\n    If the task is unknown, state will be PENDING. Once the task starts it will be updated to\n    STARTED and finally, if it completes, it will be either SUCCESS (no exceptions), or FAILURE.\n\n    See update_state() within create_and_upload_archive and\n    http://celery.readthedocs.org/en/latest/reference/celery.states.html for more details.\n\n    If state is SUCCESS, it is safe to check response['s3_urls'] for the archives submitted to s3\n    "
    task = create_and_upload_archive.AsyncResult(task_id)
    task_tracker = tables.ArchiverTask.query.filter((tables.ArchiverTask.task_id == task_id)).first()
    log.info('checking status of task id {}: current state {}'.format(task_id, task.state))
    task_info = (task.info or {})
    response = {'state': task.state}
    if (task.state != 'FAILURE'):
        response['status'] = task_info.get('status', 'no status available at this point.')
        response['src_url'] = task_info.get('src_url', '')
        response['s3_urls'] = task_info.get('s3_urls', {})
    else:
        response['status'] = str(task.info)
        response['src_url'] = ''
        response['s3_urls'] = {}
    if task_tracker:
        if (task.state in FINISHED_STATES):
            delete_tracker(task_tracker)
        elif ((task.state == 'PENDING') and (task_tracker.pending_expires_at < now())):
            log.info('Task {} has expired from pending too long. Re-creating task'.format(task.id))
            renew_tracker_pending_expiry(task_tracker)
            create_and_upload_archive.apply_async(args=[task_tracker.src_url, task_tracker.s3_key], task_id=task.id)
            response['state'] = 'RETRY'
            response['status'] = 'Task has expired from pending for too long. Re-creating task.'
        elif (task_tracker.state != task.state):
            update_tracker_state(task_tracker, task.state)
    return MozharnessArchiveTask(**response)
Check and return the current state of the create_and_upload_archive celery task with task id
of <task_id>.

If the task is unknown, state will be PENDING. Once the task starts it will be updated to
STARTED and finally, if it completes, it will be either SUCCESS (no exceptions), or FAILURE.

See update_state() within create_and_upload_archive and
http://celery.readthedocs.org/en/latest/reference/celery.states.html for more details.

If state is SUCCESS, it is safe to check response['s3_urls'] for the archives submitted to s3
@bp.route('/status/<task_id>')
@api.apimethod(MozharnessArchiveTask, unicode)
def task_status(task_id):
    "\n    Check and return the current state of the create_and_upload_archive celery task with task id\n    of <task_id>.\n\n    If the task is unknown, state will be PENDING. Once the task starts it will be updated to\n    STARTED and finally, if it completes, it will be either SUCCESS (no exceptions), or FAILURE.\n\n    See update_state() within create_and_upload_archive and\n    http://celery.readthedocs.org/en/latest/reference/celery.states.html for more details.\n\n    If state is SUCCESS, it is safe to check response['s3_urls'] for the archives submitted to s3\n    "
    task = create_and_upload_archive.AsyncResult(task_id)
    task_tracker = tables.ArchiverTask.query.filter((tables.ArchiverTask.task_id == task_id)).first()
    log.info('checking status of task id {}: current state {}'.format(task_id, task.state))
    task_info = (task.info or {})
    response = {'state': task.state}
    if (task.state != 'FAILURE'):
        response['status'] = task_info.get('status', 'no status available at this point.')
        response['src_url'] = task_info.get('src_url', )
        response['s3_urls'] = task_info.get('s3_urls', {})
    else:
        response['status'] = str(task.info)
        response['src_url'] = 
        response['s3_urls'] = {}
    if task_tracker:
        if (task.state in FINISHED_STATES):
            delete_tracker(task_tracker)
        elif ((task.state == 'PENDING') and (task_tracker.pending_expires_at < now())):
            log.info('Task {} has expired from pending too long. Re-creating task'.format(task.id))
            renew_tracker_pending_expiry(task_tracker)
            create_and_upload_archive.apply_async(args=[task_tracker.src_url, task_tracker.s3_key], task_id=task.id)
            response['state'] = 'RETRY'
            response['status'] = 'Task has expired from pending for too long. Re-creating task.'
        elif (task_tracker.state != task.state):
            update_tracker_state(task_tracker, task.state)
    return MozharnessArchiveTask(**response)