Abdulrehman-PIAIC80387 opened a new pull request, #68326:
URL: https://github.com/apache/airflow/pull/68326
Airflow 3.2 extended `DagRunInfo` with two new fields for partition-oriented
scheduling (AIP-76, #61167):
```python
class DagRunInfo(NamedTuple):
run_after: DateTime
data_interval: DataInterval | None
partition_date: DateTime | None # new in 3.2
partition_key: str | None # new in 3.2
```
Both were added **without defaults**, making them required positional
fields. Custom timetables written for 3.1.x and earlier — including the pattern
shown in the [official custom-timetable
how-to](https://airflow.apache.org/docs/apache-airflow/stable/howto/timetable.html)
— construct `DagRunInfo` with only two arguments:
```python
return DagRunInfo(
run_after=run_after,
data_interval=DataInterval(start=start, end=end),
)
```
On 3.2 this raises `TypeError: DagRunInfo.__new__() missing 2 required
positional arguments: 'partition_date' and 'partition_key'`. The exception is
swallowed by the error handling around `DAG.next_dagrun_info()`, so
`next_dagrun` / `next_dagrun_create_after` stay `NULL`, the **Next Run** column
is empty, and no scheduled runs are created — with no import error or other
visible failure. Built-in timetables are unaffected because they build
`DagRunInfo` via helpers (`DagRunInfo.interval(...)`, `DagRunInfo.exact(...)`,
etc.) that already pass the partition fields explicitly.
## Fix
Default the two partition fields to `None`. They are the trailing fields of
the `NamedTuple`, so the change is purely additive and restores the documented
two-argument construction. Every internal call site already passes all four
fields explicitly, so their behaviour is unchanged.
## Design notes
- Defaulting trailing `NamedTuple` fields is the idiomatic approach already
used in this codebase — e.g. `TaskInstanceKey` (`try_number: int = 1`,
`map_index: int = -1`). No `__new__` override or dataclass conversion is needed.
- Partitioned timetables continue to set `partition_date` / `partition_key`
explicitly; the defaults only affect callers that omit them, which is exactly
the pre-3.2 custom-timetable contract.
## Tests
Added two unit tests in `test_base_timetable.py`: the backward-compatible
two-argument construction (partition fields default to `None`) and the explicit
four-argument construction (partition fields still settable). Full
`airflow-core/tests/unit/timetables/` suite passes (220 passed).
closes: #68315
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.8)
Generated-by: Claude Code (Opus 4.8) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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]