def set_state(self, state):
        if self._state != state:
            self._state = state
            if self.dag_id is not None:
                # FIXME: Due to the scoped_session factor we we don't get a clean