frapa-az commented on issue #19836:
URL: https://github.com/apache/airflow/issues/19836#issuecomment-982465714


   I digged the code. We're not using Sub-DAGs, but we do something really 
weird with callbacks. So after all, this is our misuse of AirFlow and not a bug 
in AirFlow itself. Here the relevant snippet (I believe):
   
   ```python
   def on_failure_callback(context):
       if isinstance(context['exception'], TaskCanceledException):
           session = settings.Session()
           context['task_instance'].set_state(State.SKIPPED, session=session)
           context['dag_run'].state = State.SKIPPED
           session.merge(context['dag_run'])
           session.commit()
       
   task.on_failure_callback = on_failure_callback
   ```
   
   However, maybe it would be good to add some validation to the states before 
saving them to avoid that they go to such inconsistent states? I find it a 
little strange that AirFlow accepts this to be saved into the database, but 
then validates it when returning it from the API.
   
   


-- 
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