BasPH commented on issue #5302: [WIP][AIRFLOW-4374] Make enum-like-classes 
inherit from enum
URL: https://github.com/apache/airflow/pull/5302#issuecomment-493742770
 
 
   Yes I realise this potentially introduces many breaking DAGs, therefore it 
should be merged into Airflow 2.0 at the least.
   
   My main reason for this change is there are so many different ways of 
writing Airflow code, it can be quite confusing to users (in my experience), 
therefore if we provide only a single possible way of providing TriggerRules 
and WeightRules, it should unify and improve user experience.
   
   As an intermediate, in the BaseOperator init we could do something like 
this, to continue support for strings:
   ```python
   if trigger_rule not in TriggerRule:
       try:
           # trigger rule values such as "all_done" will be converted to the 
TriggerRule enum
           trigger_rule = TriggerRule(trigger_rule)
           # show deprecation warning here
       except ValueError:
           # trigger_rule object is neither TriggerRule enum or string known to 
TriggerRule
           raise AirflowException(...)
   ```
   
   What do you think?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to