

def pop_task_from_donequeue(queue, github_auth):
    ' Look for a completed job in the "done" task queue, update Github status.\n    '
    with queue as db:
        task = queue.get()
        if (task is None):
            return
        _L.info('Got file {name} from done queue'.format(**task.data))
        results = task.data['result']
        message = results['message']
        run_state = results.get('output', None)
        content_b64 = task.data['content_b64']
        commit_sha = task.data['commit_sha']
        worker_id = task.data.get('worker_id')
        set_id = task.data.get('set_id')
        job_url = github_auth.data['url']
        filename = task.data['name']
        file_id = task.data['file_id']
        run_id = task.data['run_id']
        job_id = task.data['job_id']
        if is_completed_run(db, run_id, task.enqueued_at):
            return
        run_status = bool((message == MAGIC_OK_MESSAGE))
        is_merged = is_merged_to_master(db, set_id, job_id, commit_sha, github_auth)
        set_run(db, run_id, filename, file_id, content_b64, run_state, run_status, job_id, worker_id, commit_sha, is_merged, set_id)
        if job_id:
            update_job_status(db, job_id, job_url, filename, run_status, results, github_auth)

dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py pop_task_from_donequeue/VarMisuse@125/221 `task`->`github_auth`