dstandish commented on code in PR #39825:
URL: https://github.com/apache/airflow/pull/39825#discussion_r1672328952
##########
airflow/models/baseoperator.py:
##########
@@ -1245,11 +1245,21 @@ def dag(self) -> DAG: # type: ignore[override]
@dag.setter
def dag(self, dag: DAG | None):
"""Operators can be assigned to one DAG, one time. Repeat assignments
to that same DAG are ok."""
- from airflow.models.dag import DAG
-
if dag is None:
self._dag = None
return
+
+ # if already set to elided, then just set and exit
+ if self._dag is ELIDED_DAG:
Review Comment:
I think I get what you're saying. The thing that doesn't feel right is that
we're saying
```
if task.dag is HAS_BEEN_SERIALIZED
```
which reads like the _dag_ has been serialized, but that's not quite what
it's saying; in reality, the _task_ has been serialized (or visited if you
like). and the dag obj on the task was _removed_.
"visited" seems a bit insufficient because it doesn't really tell you what
happened when you visited.
How about this
```
ATTRIBUTE_REMOVED
```
I think "attribute removed" is good because it's very clear, and tells the
truth.
--
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]