这是indexloc提供的服务,不要输入任何密码
Skip to content

Remove schedule_interval parameter #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

viiccwen
Copy link

This PR refactors the usage of the deprecated schedule_interval parameter and replaces it with the schedule parameter.

This is my first pull request in this project!
If there’s anything I can improve or adjust, I’d really appreciate your feedback.

resolves #454

viiccwen added 4 commits July 25, 2025 16:02
This change aligns with Airflow 2.10+ API changes where schedule_interval
is deprecated in favor of the schedule parameter. The migration is handled
automatically to ensure existing DAG configurations continue to work without
modification.
This commit updates all test fixture files to use the new schedule parameter
instead of the deprecated schedule_interval. All test configurations now
reflect the current Airflow API standards.

Files changed:
- tests/fixtures/dag_factory.yml
- tests/fixtures/dag_factory_task_group.yml
- tests/fixtures/dag_factory_http_operator_task.yml
- tests/fixtures/dag_factory_simple_http_operator_task.yml
- tests/fixtures/dag_factory_kubernetes_pod_operator.yml
- tests/fixtures/dag_factory_kubernetes_pod_operator_lt_2_7.yml
- tests/fixtures/dag_factory_variables_as_arguments.yml
- tests/fixtures/dag_factory_no_or_none_string_schedule.yml
- tests/fixtures/dag_md_docs.yml
- tests/fixtures/invalid_dag_factory.yml
- tests/fixtures/invalid_yaml.yml
- Rename test_schedule_interval() to test_schedule()
- Simplify test logic to use schedule attribute consistently
- Update get_schedule_key() to always return "schedule"
- Remove version-specific schedule_interval checks in tests
- Update test configuration strings to use schedule parameter

This commit updates the test suite to work with the new schedule parameter
and removes legacy schedule_interval logic. Tests now consistently use
the schedule attribute regardless of Airflow version, simplifying the
test codebase and ensuring compatibility with future Airflow versions.
@viiccwen viiccwen requested a review from a team as a code owner July 25, 2025 15:50
@viiccwen viiccwen deployed to external July 25, 2025 18:59 — with GitHub Actions Active
Copy link
Collaborator

@pankajastro pankajastro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @viiccwen, for the contribution. Few tests are failing; you should be able to run them locally with hatch https://astronomer.github.io/dag-factory/latest/contributing/howto/#testing-application-with-hatch

Comment on lines 192 to +193
def get_schedule_key():
airflow_version = version.parse(AIRFLOW_VERSION)
if airflow_version < version.parse("3.0.0"):
return "schedule_interval"
else:
return "schedule"
return "schedule"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think now we can delete this function, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I think so 🤔


if has_schedule_attr and not has_schedule_interval_attr and is_airflow_version_at_least_2_4:
if has_schedule_attr and is_airflow_version_at_least_2_4:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum version of Airflow is 2.4 in DAG-Factory now so we can remove check is_airflow_version_at_least_2_4

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I already see the minimum version.

Comment on lines +175 to +180
if utils.check_dict_key(dag_params, "schedule_interval"):
if dag_params["schedule_interval"] == "None":
dag_params["schedule"] = None
else:
dag_params["schedule"] = dag_params["schedule_interval"]
del dag_params["schedule_interval"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should silently convert schedule_interval to schedule. Maybe in case of schedule_interval supplied, we should error out, or at least we should log this conversion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're dropping support for airflow < 2.4 (including in our testing environment), maybe we should removed all schedule_interval handling and replaced it with a hard error.

I'll fix the tests first, and waiting for the reply : D

@viiccwen
Copy link
Author

@pankajastro Thanks for replying and reviewing, I'll handle this ASAP!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove schedule_interval
2 participants