uranusjr commented on code in PR #65586:
URL: https://github.com/apache/airflow/pull/65586#discussion_r3115718039
##########
airflow-core/src/airflow/serialization/definitions/dag.py:
##########
@@ -246,6 +246,13 @@ def get_task(self, task_id: str) -> SerializedOperator:
return self.task_dict[task_id]
raise TaskNotFound(f"Task {task_id} not found")
+ def __getitem__(self, task_id: str) -> SerializedOperator:
+ """Return a task by its fully-qualified task_id."""
+ try:
+ return self.get_task(task_id)
+ except TaskNotFound:
+ raise TaskItemNotFound(f"Task {task_id!r} not found")
Review Comment:
This should probably also support task groups? `TaskGroup.__getitem__` does.
--
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]