Skip to content

Commit

Permalink
Move [scheduler]dag_dir_list_interval to `[dag_bundles]refresh_inte…
Browse files Browse the repository at this point in the history
…rval` (#45722)

This config should be the default refresh_interval in AF3, so move its
predecesor.
  • Loading branch information
jedcunningham authored Jan 17, 2025
1 parent 5f7269c commit 6cde25f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
16 changes: 8 additions & 8 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2286,13 +2286,6 @@ scheduler:
type: integer
example: ~
default: "50"
dag_dir_list_interval:
description: |
How often (in seconds) to scan the DAGs directory for new files. Default to 5 minutes.
version_added: ~
type: integer
example: ~
default: "300"
print_stats_interval:
description: |
How often should stats be printed to the logs. Setting to 0 will disable printing stats
Expand Down Expand Up @@ -2681,7 +2674,7 @@ dag_bundles:
description: |
List of backend configs. Must supply name, classpath, and kwargs for each backend.
By default, ``refresh_interval`` is set to ``[scheduler] dag_dir_list_interval``, but that can
By default, ``refresh_interval`` is set to ``[dag_bundles] refresh_interval``, but that can
also be overridden in kwargs if desired.
The default is the dags folder dag bundle.
Expand Down Expand Up @@ -2711,3 +2704,10 @@ dag_bundles:
"kwargs": {{}}
}}
]
refresh_interval:
description: |
How often (in seconds) to refresh, or look for new files, in a DAG bundle.
version_added: ~
type: integer
example: ~
default: "300"
1 change: 0 additions & 1 deletion airflow/config_templates/unit_tests.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ result_backend = db+mysql://airflow:airflow@localhost:3306/airflow
job_heartbeat_sec = 1
scheduler_heartbeat_sec = 5
parsing_processes = 2
dag_dir_list_interval = 0

[triggerer]
# Those values are set so that during unit tests things run faster than usual.
Expand Down
4 changes: 3 additions & 1 deletion airflow/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ def sensitive_config_values(self) -> set[tuple[str, str]]:
# A mapping of (new section, new option) -> (old section, old option, since_version).
# When reading new option, the old option will be checked to see if it exists. If it does a
# DeprecationWarning will be issued and the old option will be used instead
deprecated_options: dict[tuple[str, str], tuple[str, str, str]] = {}
deprecated_options: dict[tuple[str, str], tuple[str, str, str]] = {
("dag_bundles", "refresh_interval"): ("scheduler", "dag_dir_list_interval", "3.0"),
}

# A mapping of new section -> (old section, since_version).
deprecated_sections: dict[str, tuple[str, str]] = {}
Expand Down
8 changes: 7 additions & 1 deletion airflow/dag_processing/bundles/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ class BaseDagBundle(ABC):

supports_versioning: bool = False

def __init__(self, *, name: str, refresh_interval: int = 300, version: str | None = None) -> None:
def __init__(
self,
*,
name: str,
refresh_interval: int = conf.getint("dag_bundles", "refresh_interval"),
version: str | None = None,
) -> None:
self.name = name
self.version = version
self.refresh_interval = refresh_interval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ However, you can also look at other non-performance-related scheduler configurat
queued tasks that were launched by the dead process will be "adopted" and
monitored by this scheduler instead.

- :ref:`config:scheduler__dag_dir_list_interval`
How often (in seconds) to scan the DAGs directory for new files.

- :ref:`config:scheduler__file_parsing_sort_mode`
The scheduler will list and sort the DAG files to decide the parsing order.

Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/best-practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ each parameter by following the links):

* :ref:`config:scheduler__scheduler_idle_sleep_time`
* :ref:`config:scheduler__min_file_process_interval`
* :ref:`config:scheduler__dag_dir_list_interval`
* :ref:`config:dag_bundles__refresh_interval`
* :ref:`config:scheduler__parsing_processes`
* :ref:`config:scheduler__file_parsing_sort_mode`

Expand Down

0 comments on commit 6cde25f

Please sign in to comment.