necmo opened a new pull request, #65222:
URL: https://github.com/apache/airflow/pull/65222
**Issue:** closes #65220
## Summary
Add `__repr__` and `__str__` methods to `ArgNotSet` to return a stable
`"NOTSET"` string instead of Python's default `<... object at 0x...>` which
includes the memory address.
## Problem
When `ArgNotSet` instances leak into serialization paths that fall through
to `str()`/`repr()` (e.g., `TriggerDagRunOperator`'s `logical_date` parameter
appearing in serialized `default_args`), the output includes the memory address:
```
"logical_date": "<airflow.serialization.definitions.notset.ArgNotSet object
at 0x7fe833fa8f20>"
```
Since the scheduler runs `DagFileProcessor` as separate subprocesses, each
process allocates `ArgNotSet` at a different address → different serialized
JSON → new `dag_version` on every parse cycle (~30 seconds).
## Fix
```python
class ArgNotSet:
"""Sentinel type for annotations, useful when None is not viable."""
def __repr__(self) -> str:
return "NOTSET"
def __str__(self) -> str:
return "NOTSET"
```
This ensures that even if `ArgNotSet` bypasses the proper `is_arg_set()`
check in serialization, the resulting string is deterministic and does not
cause spurious DAG version increments.
--
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]