Deletes the job together with its logs and metadata.

    :param job_id: An identifier for the job
    :type job_id: string

    :statuscode 200: no error
    :statuscode 403: not authorized to delete the job
    :statuscode 404: the job could not be found
    :statuscode 409: an error occurred

def job_delete(job_id):
    '''Deletes the job together with its logs and metadata.

    :param job_id: An identifier for the job
    :type job_id: string

    :statuscode 200: no error
    :statuscode 403: not authorized to delete the job
    :statuscode 404: the job could not be found
    :statuscode 409: an error occurred
    '''
    conn = db.ENGINE.connect()
    job = db.get_job(job_id)
    if not job:
        return json.dumps({'error': 'job_id not found'}), 404, headers
    if not is_authorized(job):
        return json.dumps({'error': 'not authorized'}), 403, headers
    trans = conn.begin()
    try:
        conn.execute(db.JOBS_TABLE.delete().where(
                     db.JOBS_TABLE.c.job_id == job_id))
        trans.commit()
        return json.dumps({'success': True}), 200, headers
    except Exception, e:
        trans.rollback()
        return json.dumps({'error': str(e)}), 409, headers
    finally:
        conn.close()