sortega commented on code in PR #68568:
URL: https://github.com/apache/airflow/pull/68568#discussion_r3580484981
##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -736,9 +736,19 @@ def __hash__(self):
@property
def stats_tags(self) -> dict[str, str]:
"""Returns task instance tags."""
- return prune_dict(
- {"dag_id": self.dag_id, "task_id": self.task_id, "team_name":
getattr(self, "_team_name", None)}
+ run_type = self.dag_run.run_type
+ base = prune_dict(
+ {
+ "dag_id": self.dag_id,
+ "task_id": self.task_id,
+ # bare value so it serializes as e.g. "scheduled", not
"dagruntype.scheduled"
+ "run_type": getattr(run_type, "value", run_type),
+ "team_name": getattr(self, "_team_name", None),
+ }
)
+ dag_tags = self.dag_run.dag_tags_for_stats()
+ # Built-in keys win on collision; dag tags fill in everything else.
+ return {**dag_tags, **base}
Review Comment:
Almost. The _team_name attribute is set at each of the classes and we need
to keep it or rewrite the tests.
Simplified everything else.
--
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]