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