tooptoop4 commented on issue #6954: [AIRFLOW-4355] removed task should not lead 
to dagrun success
URL: https://github.com/apache/airflow/pull/6954#issuecomment-571383906
 
 
   > Can you add some tests?
   
   it is tough to reproduce the scenario.
   I tried below but it always says DAGRun is still 'running' rather than 
'failed':
   `   def test_dagrun_remove_callback(self):
           def on_removed_callable(context):
               self.assertEqual(
                   context['dag_run'].dag_id,
                   'test_dagrun_remove_callback'
               )
   
           conf.set("scheduler", "REMOVED_TASKS_LEAD_TO_DAGRUN_FAILURE", "True")
   
           dag = DAG(
               dag_id='test_dagrun_remove_callback',
               start_date=datetime.datetime(2017, 1, 1),
               on_failure_callback=on_removed_callable,
           )
           dag_task1 = DummyOperator(
               task_id='test_state_removed1',
               dag=dag)
               
           initial_task_states = {
               'test_state_removed1': State.REMOVED
           }
   
           dag_run = self.create_dag_run(dag=dag,
                                         state=State.RUNNING,
                                         task_states=initial_task_states)
           # dag_run.verify_integrity()
           updated_dag_state = dag_run.update_state()
           self.assertEqual(State.FAILED, updated_dag_state)`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to