dimonchik-suvorov commented on PR #30125:
URL: https://github.com/apache/airflow/pull/30125#issuecomment-1514546278

   > Since the maintainers are not allowed to edit this PR, can you apply this 
patch?
   > 
   > ```diff
   > diff --git a/airflow/models/taskinstance.py 
b/airflow/models/taskinstance.py
   > index f5b85a8af5..a973837689 100644
   > --- a/airflow/models/taskinstance.py
   > +++ b/airflow/models/taskinstance.py
   > @@ -193,8 +193,8 @@ def clear_task_instances(
   >  
   >      :param tis: a list of task instances
   >      :param session: current session
   > -    :param dag_run_state: state to set DagRun to. If set to False, dagrun 
state will not
   > -        be changed.
   > +    :param dag_run_state: state to set finished DagRuns to. If set to 
False,
   > +        DagRuns state will not be changed.
   >      :param dag: DAG object
   >      :param activate_dag_runs: Deprecated parameter, do not pass
   >      """
   > diff --git a/airflow/utils/state.py b/airflow/utils/state.py
   > index 67638ab1a1..f4a8dc1a0a 100644
   > --- a/airflow/utils/state.py
   > +++ b/airflow/utils/state.py
   > @@ -96,7 +96,7 @@ class State:
   >      DEFERRED = TaskInstanceState.DEFERRED
   >  
   >      finished_dr_states: frozenset[DagRunState] = 
frozenset([DagRunState.SUCCESS, DagRunState.FAILED])
   > -    unfinished_dr_states: frozenset[DagRunState] = 
frozenset([DagRunState.SUCCESS, DagRunState.FAILED])
   > +    unfinished_dr_states: frozenset[DagRunState] = 
frozenset([DagRunState.QUEUED, DagRunState.RUNNING])
   >  
   >      task_states: tuple[TaskInstanceState | None, ...] = (None,) + 
tuple(TaskInstanceState)
   >  
   > diff --git a/tests/models/test_cleartasks.py 
b/tests/models/test_cleartasks.py
   > index 8e42aea45c..4fa7363d96 100644
   > --- a/tests/models/test_cleartasks.py
   > +++ b/tests/models/test_cleartasks.py
   > @@ -172,8 +172,9 @@ class TestClearTasks:
   >  
   >      @pytest.mark.parametrize("state", [DagRunState.QUEUED, 
DagRunState.RUNNING])
   >      def test_clear_task_instances_on_running_dr(self, state, dag_maker):
   > -        """Test that DR state, start_date and last_scheduling_decision 
doesn't change after clear
   > -        if it's been cleared on a unfinished RD.
   > +        """
   > +        Test that DagRun state, start_date and last_scheduling_decision
   > +        are not changed after clearing TI in an unfinished DagRun.
   >          """
   >          with dag_maker(
   >              "test_clear_task_instances",
   > @@ -217,8 +218,9 @@ class TestClearTasks:
   >          ],
   >      )
   >      def test_clear_task_instances_on_finished_dr(self, state, 
last_scheduling, dag_maker):
   > -        """Test that DR state, start_date and last_scheduling_decision 
doesn't change after clear
   > -        if it's been cleared on a unfinished RD.
   > +        """
   > +        Test that DagRun state, start_date and last_scheduling_decision
   > +        are changed after clearing TI in a finished DagRun.
   >          """
   >          with dag_maker(
   >              "test_clear_task_instances",
   > diff --git a/tests/models/test_dagrun.py b/tests/models/test_dagrun.py
   > index 5cb9a00801..8df2e9e0c1 100644
   > --- a/tests/models/test_dagrun.py
   > +++ b/tests/models/test_dagrun.py
   > @@ -112,7 +112,7 @@ class TestDagRun:
   >          return dag_run
   >  
   >      @pytest.mark.parametrize("state", [DagRunState.QUEUED, 
DagRunState.RUNNING])
   > -    def test_clear_task_instances_for_backfill_running_dagrun(self, 
state, session):
   > +    def test_clear_task_instances_for_backfill_unfinished_dagrun(self, 
state, session):
   >          now = timezone.utcnow()
   >          dag_id = "test_clear_task_instances_for_backfill_dagrun"
   >          dag = DAG(dag_id=dag_id, start_date=now)
   > ```
   
   all changes applied :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to