uranusjr commented on code in PR #39165:
URL: https://github.com/apache/airflow/pull/39165#discussion_r1730999043
##########
airflow/utils/types.py:
##########
@@ -99,3 +99,18 @@ class EdgeInfoType(TypedDict):
"""Extra metadata that the DAG can store about an edge, usually generated
from an EdgeModifier."""
label: str | None
+
+
+class DagRunTriggeredByType(str, enum.Enum):
+ """Class with TriggeredBy types for DagRun."""
+
+ CLI = "cli" # for the trigger subcommand of the CLI: airflow dags trigger
+ OPERATOR = "operator" # for the TriggerDagRunOperator
+ REST_API = "rest_api" # for triggering the DAG via RESTful API
+ UI = "ui" # for clicking the `Trigger DAG` button
+ TEST = "test" # for dag.test()
+ TIMETABLE = "timetable" # for timetable based triggering
+ DATASET = "dataset" # for dataset_triggered run type
+
+ def __str__(self):
+ return self.value
Review Comment:
```suggestion
```
Same. I think the API needs some changes to accomodate this change.
##########
airflow/utils/types.py:
##########
@@ -99,3 +99,18 @@ class EdgeInfoType(TypedDict):
"""Extra metadata that the DAG can store about an edge, usually generated
from an EdgeModifier."""
label: str | None
+
+
+class DagRunTriggeredByType(str, enum.Enum):
Review Comment:
```suggestion
class DagRunTriggeredByType(enum.Enum):
```
Existing enums subclass from str due to compatibility; we don’t need that
here.
##########
airflow/api_connexion/schemas/dag_run_schema.py:
##########
@@ -74,6 +74,7 @@ class Meta:
last_scheduling_decision = auto_field(dump_only=True)
run_type = auto_field(dump_only=True)
note = auto_field(dump_only=False)
+ triggered_by = auto_field(dump_only=True)
Review Comment:
Not sure how this field would work if the enum does not subclass from str.
We’ll find out with tests.
--
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]