def pop_task_from_duequeue(queue, github_auth):
    '''
    '''
    with queue as db:
        task = queue.get()
    
        if task is None:
            return
        
        _L.info(u'Got file {name} from due queue'.format(**task.data))
        original_task = task.data['task_data']
        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 = task.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):
            # Everything's fine, this got handled.
            return

        run_status = False
        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, None, 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, False, github_auth)
dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py/pop_task_from_duequeue/original