(parent_app_name, parent_job_id)
This is basically a "set_state(completed=True)" pre-commit hook

    Assume the task identified by (parent_app_name, parent_job_id) is
    completed, and for each of that parent's children in the dag graph of
    tasks, set 1/num_parents worth of points towards that child's completion.

    If any one child has earned 1 point, then add it to its task queue

    We track the "score" of a child by counting files in the job path:
        .../parents/dependency_name/parent_app_name/parent_job_id
This is basically a "set_state(completed=True)" pre-commit hook
This is basically a set_state ( completed = True ) pre - commit hook
def _maybe_queue_children(parent_app_name, parent_job_id):
    """
    This is basically a "set_state(completed=True)" pre-commit hook

    Assume the task identified by (parent_app_name, parent_job_id) is
    completed, and for each of that parent's children in the dag graph of
    tasks, set 1/num_parents worth of points towards that child's completion.

    If any one child has earned 1 point, then add it to its task queue

    We track the "score" of a child by counting files in the job path:
        .../parents/dependency_name/parent_app_name/parent_job_id
    """
    qbcli = shared.get_qbclient()
    gen = dt.get_children(parent_app_name, parent_job_id, True)
    for child_app_name, cjob_id, dep_grp in gen:
        ld = dict(
            child_app_name=child_app_name,
            child_job_id=cjob_id,
            app_name=parent_app_name,
            job_id=parent_job_id)
        ptotal = len(list(dt.get_parents(child_app_name, cjob_id)))
        pcomplete = qbcli.increment(
            _path_num_complete_parents(child_app_name, cjob_id))

        if (pcomplete >= ptotal):
            log.info(
                "Parent is queuing a child task", extra=ld)
            if pcomplete > ptotal:
                log.warn(
                    "For some reason, I calculated that more parents"
                    " completed than there are parents."
                    " If you aren't re-adding tasks, this could be a code bug"
                    " that results in tasks unnecessarily sitting in queue.",
                    extra=dict(
                        num_complete_dependencies=pcomplete,
                        num_total_dependencies=ptotal, **ld))
            if check_state(child_app_name, cjob_id, completed=True):
                log.warn(
                    "Queuing a previously completed child task"
                    " presumably because of the following:"
                    " 1) you manually queued both a"
                    " parent/ancestor and the child,"
                    " and 2) the child completed first."
                    " You probably shouldn't manually re-queue both parents"
                    " and children. Just queue one of them.",
                    extra=ld)

            try:
                readd_subtask(
                    child_app_name, cjob_id,
                    _reset_descendants=False,  # descendants previously handled
                    _ignore_if_queued=True)
            except exceptions.JobAlreadyQueued:
                log.info("Child already in queue", extra=dict(**ld))
                raise
        elif (pcomplete < ptotal):
            log.info(
                "Child job one step closer to being queued!",
                extra=dict(
                    num_complete_dependencies=pcomplete,
                    num_total_dependencies=ptotal, **ld))
def _maybe_queue_children ( parent_app_name , parent_job_id ) : qbcli = shared . get_qbclient ( ) gen = dt . get_children ( parent_app_name , parent_job_id , True ) for child_app_name , cjob_id , dep_grp in gen : ld = dict ( child_app_name = child_app_name , child_job_id = cjob_id , app_name = parent_app_name , job_id = parent_job_id ) ptotal = len ( list ( dt . get_parents ( child_app_name , cjob_id ) ) ) pcomplete = qbcli . increment ( _path_num_complete_parents ( child_app_name , cjob_id ) ) if ( pcomplete >= ptotal ) : log . info ( "Parent is queuing a child task" , extra = ld ) if pcomplete > ptotal : log . warn ( "For some reason, I calculated that more parents" " completed than there are parents." " If you aren't re-adding tasks, this could be a code bug" " that results in tasks unnecessarily sitting in queue." , extra = dict ( num_complete_dependencies = pcomplete , num_total_dependencies = ptotal , * * ld ) ) if check_state ( child_app_name , cjob_id , completed = True ) : log . warn ( "Queuing a previously completed child task" " presumably because of the following:" " 1) you manually queued both a" " parent/ancestor and the child," " and 2) the child completed first." " You probably shouldn't manually re-queue both parents" " and children. Just queue one of them." , extra = ld ) try : readd_subtask ( child_app_name , cjob_id , _reset_descendants = False , # descendants previously handled _ignore_if_queued = True ) except exceptions . JobAlreadyQueued : log . info ( "Child already in queue" , extra = dict ( * * ld ) ) raise elif ( pcomplete < ptotal ) : log . info ( "Child job one step closer to being queued!" , extra = dict ( num_complete_dependencies = pcomplete , num_total_dependencies = ptotal , * * ld ) )