def set_op_upstreams(op_run, op):
<EOL>upstream_ops = op.upstream_operations.values_list('<STR_LIT:id>', flat=True)<EOL>latest_op_runs = OperationRun.objects.filter(id__in=upstream_ops)<EOL>latest_op_runs = latest_op_runs.annotate(max_date=Max('<STR_LIT>'))<EOL>latest_op_runs = latest_op_runs.filter(date=F('<STR_LIT>'))<EOL>op_run.set(latest_op_runs)<EOL>
Set the upstream operations for operation run.