@provide_session<EOL><INDENT>def _set_unfinished_dag_runs_to_failed(self, dag_runs, session=None):<DEDENT>
for dag_run in dag_runs:<EOL><INDENT>dag_run.update_state()<EOL>if dag_run.state not in State.finished():<EOL><INDENT>dag_run.set_state(State.FAILED)<EOL><DEDENT>session.merge(dag_run)<EOL><DEDENT>
Go through the dag_runs and update the state based on the task_instance state.
Then set DAG runs that are not finished to failed.

:param dag_runs: DAG runs
:param session: session
:return: None