def run_consistent_to_job()

in lib/run_printer.py [0:0]


def run_consistent_to_job(run, job_id):
    """True iff the reverse-dependencies of job_id are marked as complete"""

    out_to_status = {}
    job_ins = []
    found = False

    for pipe in run["pipelines"]:
        for stage in pipe["ci_stages"]:
            for job in stage["jobs"]:
                current_id = job["wrapper_arguments"]["job_id"]
                if current_id == job_id:
                    found = True
                    job_ins = job["wrapper_arguments"]["inputs"] or []

                for out in job["wrapper_arguments"]["outputs"] or []:
                    if out in out_to_status:
                        logging.warning(
                            "Two jobs share an output '%s'. Jobs: %s and %s",
                            out, out_to_status[out]["job_id"], current_id)
                    out_to_status[out] = {
                        "job_id": current_id,
                        "complete": job["complete"],
                    }
    if not found:
        logging.error(
            "Could not find job with ID '%s' in run", job_id)
        raise InconsistentRunError()

    for inputt in job_ins:
        if inputt not in out_to_status:
            continue
        if not out_to_status[inputt]["complete"]:
            logging.debug(
                "Run inconsistent: job '%s' is a reverse-dependency of "
                "job '%s' through input '%s', but the reverse-dependency "
                "job is not marked as complete.",
                out_to_status[inputt]["job_id"], job_id, inputt)
            raise InconsistentRunError()
    return True