self,
        tis: Collection[TaskInstance],
        target_state: TaskInstanceState,
        session: Session = NEW_SESSION,
    ) -> None:
        """Set task instance state."""
        try:
            count = len(tis)
            for ti in tis:
                ti.set_state(target_state, session)
            session.commit()
            flash(f"{count} task instances were set to '{target_state}'")
        except Exception:
            flash("Failed to set state", "error")
    @action("set_running", "Set state to 'running'", "", single=False)
    @action_has_dag_edit_access
    @action_logging
    def action_set_running(self, tis):
        """Set state to 'running'."""
        self.set_task_instance_state(tis, TaskInstanceState.RUNNING)
        self.update_redirect()
        return redirect(self.get_redirect())
    @action("set_failed", "Set state to 'failed'", "", single=False)
    @action_has_dag_edit_access
    @action_logging
    def action_set_failed(self, tis):