guytalzip opened a new issue, #31723:
URL: https://github.com/apache/airflow/issues/31723
### Apache Airflow version
Other Airflow 2 version (please specify below)
### What happened
Airflow version 2.5.3
When configuring the following 2 settings on a DAG:
1. **start_date** far away in the future (for example year 2100).
2. **schedule_interval** is provided (set to any value, that is not 'None').
The Airflow scheduler crashes with the following exception:
`Creating DagRun needs either `run_id` or both `run_type` and
`execution_date``
The full stack trace:
```
File "/opt/venv/bin/airflow", line 8, in <module>
sys.exit(main())
File "/opt/venv/lib/python3.8/site-packages/airflow/__main__.py", line 48,
in main
args.func(args)
File "/opt/venv/lib/python3.8/site-packages/airflow/cli/cli_parser.py",
line 52, in command
return func(*args, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/airflow/utils/cli.py", line
108, in wrapper
return f(*args, **kwargs)
File
"/opt/venv/lib/python3.8/site-packages/airflow/cli/commands/scheduler_command.py",
line 73, in scheduler
_run_scheduler_job(args=args)
File
"/opt/venv/lib/python3.8/site-packages/airflow/cli/commands/scheduler_command.py",
line 43, in _run_scheduler_job
job.run()
File "/opt/venv/lib/python3.8/site-packages/airflow/jobs/base_job.py",
line 258, in run
self._execute()
File
"/opt/venv/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", line
759, in _execute
self._run_scheduler_loop()
File
"/opt/venv/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", line
885, in _run_scheduler_loop
num_queued_tis = self._do_scheduling(session)
File
"/opt/venv/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", line
956, in _do_scheduling
self._create_dagruns_for_dags(guard, session)
File "/opt/venv/lib/python3.8/site-packages/airflow/utils/retries.py",
line 78, in wrapped_function
for attempt in run_with_db_retries(max_retries=retries, logger=logger,
**retry_kwargs):
File "/opt/venv/lib/python3.8/site-packages/tenacity/__init__.py", line
347, in __iter__
do = self.iter(retry_state=retry_state)
File "/opt/venv/lib/python3.8/site-packages/tenacity/__init__.py", line
314, in iter
return fut.result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in
__get_result
raise self._exception
File "/opt/venv/lib/python3.8/site-packages/airflow/utils/retries.py",
line 87, in wrapped_function
return func(*args, **kwargs)
File
"/opt/venv/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", line
1024, in _create_dagruns_for_dags
self._create_dag_runs(non_dataset_dags, session)
File
"/opt/venv/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", line
1078, in _create_dag_runs
dag.create_dagrun(
File "/opt/venv/lib/python3.8/site-packages/airflow/utils/session.py",
line 72, in wrapper
return func(*args, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/airflow/models/dag.py", line
2629, in create_dagrun
raise AirflowException(
airflow.exceptions.AirflowException: Creating DagRun needs either `run_id`
or both `run_type` and `execution_date`
```
Notes:
To narrow down the issue, I tried several other settings and all of them
work fine:
- I tried future dates, but much closer (for example year 2024)- the issue
is not reproduced.
- I tried setting schedule_interval to 'None' - the issue is not reproduced.
### What you think should happen instead
The Airflow scheduler should not crash, or alternatively, provide a clear
error message saying the **start_date** is too far in the future
### How to reproduce
1. Add the following settings to your DAG:
```
start_date: '2100-01-01T12:00:00'
schedule_interval: '0 0 * * *'
```
2. Trigger Airflow scheduler parsing of the DAG
3. The exception will be reported in the scheduler logs:
`Creating DagRun needs either `run_id` or both `run_type` and
`execution_date``
### Operating System
Ubuntu 20.04.6 LTS
### Versions of Apache Airflow Providers
_No response_
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]