Set the upstream runs for the operation runs in the dag following the topological sort.

def set_topological_dag_upstreams(dag, ops, op_runs, runs_by_ops):
    """Set the upstream runs for the operation runs in the dag following the topological sort."""
    sorted_ops = dags.sort_topologically(dag=dag)
    for op_id in sorted_ops:
        op_run_id = runs_by_ops[op_id]
        op_run = op_runs[op_run_id]
        set_op_upstreams(op_run=op_run, op=ops[op_id])