self, actual_start_date, reschedule_exception, test_mode=False, session=NEW_SESSION
    ):
        
        if test_mode:
            return
        from airflow.models.dagrun import DagRun  
        self.refresh_from_db(session)
        self.end_date = timezone.utcnow()
        self.set_duration()
        
        
        with_row_locks(
            session.query(DagRun).filter_by(
                dag_id=self.dag_id,
                run_id=self.run_id,
            ),
            session=session,
        ).one()
        
        session.add(
            TaskReschedule(
                self.task,
                self.run_id,
                self._try_number,
                actual_start_date,
                self.end_date,
                reschedule_exception.reschedule_date,
                self.map_index,