@app.route('/jobs/<job_key>/', methods=['GET'])
def job_status(job_key):
    try:
        job = Job.fetch(job_key, connection=conn)
    except NoSuchJobError:
        return Response(json.dumps({'error': True, 'status_msg': '{} is not a valid job key.'.format(job_key)}), mimetype='application/json', status=404)
    if job.is_finished:
        return Response(json.dumps(job.result), mimetype='application/json', status=200)
    elif job.is_failed:
        logger.error('Job {} failed.\n{}'.format(job_key, job.exc_info))
        return Response(json.dumps({'error': True, 'status_msg': 'Job {} failed to complete.'.format(job_key)}), mimetype='application/json', status=500)
    else:
        return Response(json.dumps(job.meta), mimetype='application/json', status=202)
@app.route('/jobs/<job_key>/', methods=['GET'])
def job_status(job_key):
    try:
        job = Job.fetch(job_key, connection=conn)
    except NoSuchJobError:
        return Response(json.dumps({'error': True, 'status_msg': '{} is not a valid job key.'.format(job_key)}), mimetype='application/json', status=404)
    if job.is_finished:
        return Response(json.dumps(job.result), mimetype='application/json', status=200)
    elif job.is_failed:
        logger.error('Job {} failed.\n{}'.format(job_key, job.exc_info))
        return Response(json.dumps({'error': True, 'status_msg': 'Job {} failed to complete.'.format(job_key)}), mimetype='application/json', status=500)
    else:
        return Response(json.dumps(job.meta), mimetype='application/json', status=202)