def update_job_status(db, job_id, job_url, filename, run_status, results, github_auth):
    '''
    '''
    try:
        job = read_job(db, job_id)
    except __HOLE__:
        raise Exception('Job {} not found'.format(job_id))

    if filename not in job.states:
        raise Exception('Unknown file from job {}: "{}"'.format(job.id, filename))
    
    filenames = list(job.task_files.values())
    job.states[filename] = run_status
    job.file_results[filename] = results
    
    # Update job status.

    if False in job.states.values():
        # Any task failure means the whole job has failed.
        job.status = False
    elif None in job.states.values():
        job.status = None
    else:
        job.status = True
    
    write_job(db, job.id, job.status, job.task_files, job.states, job.file_results,
              job.github_owner, job.github_repository, job.github_status_url)
    
    if not job.github_status_url:
        _L.warning('No status_url to tell about {} status of job {}'.format(job.status, job.id))
        return
    
    if job.status is False:
        bad_files = [name for (name, state) in job.states.items() if state is False]
        update_failing_status(job.github_status_url, job_url, bad_files, filenames, github_auth)
    
    elif job.status is None:
        update_pending_status(job.github_status_url, job_url, filenames, github_auth)
    
    elif job.status is True:
        update_success_status(job.github_status_url, job_url, filenames, github_auth)
dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py/update_job_status