[ 
https://issues.apache.org/jira/browse/AIRFLOW-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bas Harenslak reassigned AIRFLOW-4374:
--------------------------------------

    Assignee: Bas Harenslak

> Inherit from Enum
> -----------------
>
>                 Key: AIRFLOW-4374
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4374
>             Project: Apache Airflow
>          Issue Type: Sub-task
>            Reporter: Bas Harenslak
>            Assignee: Bas Harenslak
>            Priority: Minor
>
> Python 3.4 introduced the Enum type, which can reduce the complexity of a few 
> enum-style classes. E.g. the TriggerRule could become:
> {code:java}
> from enum import Enum
> class TriggerRule(Enum):
>     ALL_SUCCESS = "all_success"
>     ALL_FAILED = "all_failed"
>     ALL_DONE = "all_done"
>     ONE_SUCCESS = "one_success"
>     ONE_FAILED = "one_failed"
>     NONE_FAILED = "none_failed"
>     NONE_SKIPPED = "none_skipped"
>     DUMMY = "dummy"
>     @classmethod
>     def all_triggers(cls):
>         return [tr.name for tr in TriggerRule]
> {code}
>  A quick scan showed me enum-like class are TriggerRule, WeightRule, -State-, 
> but there might be more, so search first.
> Also, note this is optional and not required for running in Python 3.
>  
> Edit: not touching the State in this one, since state contains additional 
> attributes (e.g. state_color) and in Python Enum all attributes are part of 
> the Enum class, which we don't want in this case. Will have to rethink this 
> one.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to