Skip to content

Commit 94387a0

Browse files
dirraojoaopamaral
authored andcommitted
Deprecated configuration removed (apache#42129)
1 parent 8859bed commit 94387a0

File tree

7 files changed

+47
-39
lines changed

7 files changed

+47
-39
lines changed

airflow/configuration.py

+1-19
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,6 @@ def sensitive_config_values(self) -> Set[tuple[str, str]]: # noqa: UP006
326326
# When reading new option, the old option will be checked to see if it exists. If it does a
327327
# DeprecationWarning will be issued and the old option will be used instead
328328
deprecated_options: dict[tuple[str, str], tuple[str, str, str]] = {
329-
("celery", "worker_precheck"): ("core", "worker_precheck", "2.0.0"),
330-
("scheduler", "parsing_processes"): ("scheduler", "max_threads", "1.10.14"),
331-
("operators", "default_queue"): ("celery", "default_queue", "2.1.0"),
332-
("core", "hide_sensitive_var_conn_fields"): ("admin", "hide_sensitive_variable_fields", "2.1.0"),
333-
("core", "sensitive_var_conn_names"): ("admin", "sensitive_variable_fields", "2.1.0"),
334-
("core", "default_pool_task_slot_count"): ("core", "non_pooled_task_slot_count", "1.10.4"),
335-
("core", "max_active_tasks_per_dag"): ("core", "dag_concurrency", "2.2.0"),
336-
("api", "access_control_allow_origins"): ("api", "access_control_allow_origin", "2.2.0"),
337-
("api", "auth_backends"): ("api", "auth_backend", "2.3.0"),
338329
("database", "sql_alchemy_conn"): ("core", "sql_alchemy_conn", "2.3.0"),
339330
("database", "sql_engine_encoding"): ("core", "sql_engine_encoding", "2.3.0"),
340331
("database", "sql_engine_collation_for_ids"): ("core", "sql_engine_collation_for_ids", "2.3.0"),
@@ -347,19 +338,10 @@ def sensitive_config_values(self) -> Set[tuple[str, str]]: # noqa: UP006
347338
("database", "sql_alchemy_connect_args"): ("core", "sql_alchemy_connect_args", "2.3.0"),
348339
("database", "load_default_connections"): ("core", "load_default_connections", "2.3.0"),
349340
("database", "max_db_retries"): ("core", "max_db_retries", "2.3.0"),
350-
("scheduler", "parsing_cleanup_interval"): ("scheduler", "deactivate_stale_dags_interval", "2.5.0"),
351-
("scheduler", "task_queued_timeout_check_interval"): (
352-
"kubernetes_executor",
353-
"worker_pods_pending_timeout_check_interval",
354-
"2.6.0",
355-
),
356-
("fab", "update_fab_perms"): ("webserver", "update_fab_perms", "2.9.0"),
357-
("fab", "auth_rate_limited"): ("webserver", "auth_rate_limited", "2.9.0"),
358-
("fab", "auth_rate_limit"): ("webserver", "auth_rate_limit", "2.9.0"),
359341
}
360342

361343
# A mapping of new section -> (old section, since_version).
362-
deprecated_sections: dict[str, tuple[str, str]] = {"kubernetes_executor": ("kubernetes", "2.5.0")}
344+
deprecated_sections: dict[str, tuple[str, str]] = {}
363345

364346
# Now build the inverse so we can go from old_section/old_key to new_section/new_key
365347
# if someone tries to retrieve it based on old_section/old_key

airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ def __init__(self):
140140
self.last_handled: dict[TaskInstanceKey, float] = {}
141141
self.kubernetes_queue: str | None = None
142142
self.task_publish_retries: Counter[TaskInstanceKey] = Counter()
143-
self.task_publish_max_retries = conf.getint("kubernetes", "task_publish_max_retries", fallback=0)
143+
self.task_publish_max_retries = conf.getint(
144+
"kubernetes_executor", "task_publish_max_retries", fallback=0
145+
)
144146
super().__init__(parallelism=self.kube_config.parallelism)
145147

146148
def _list_pods(self, query_kwargs):

airflow/providers/fab/auth_manager/fab_auth_manager.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,15 @@ def _sync_appbuilder_roles(self):
523523
# Otherwise, when the name of a view or menu is changed, the framework
524524
# will add the new Views and Menus names to the backend, but will not
525525
# delete the old ones.
526-
if conf.getboolean(
527-
"fab", "UPDATE_FAB_PERMS", fallback=conf.getboolean("webserver", "UPDATE_FAB_PERMS")
528-
):
526+
from packaging.version import Version
527+
528+
from airflow.version import version
529+
530+
if Version(Version(version).base_version) >= Version("3.0.0"):
531+
fallback = None
532+
else:
533+
fallback = conf.getboolean("webserver", "UPDATE_FAB_PERMS")
534+
if conf.getboolean("fab", "UPDATE_FAB_PERMS", fallback=fallback):
529535
self.security_manager.sync_roles()
530536

531537

newsfragments/42129.significant.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Removed deprecated configuration.
2+
3+
* Removed deprecated configuration ``worker_precheck`` from ``core``. Please use ``worker_precheck`` from ``celery`` instead.
4+
* Removed deprecated configuration ``max_threads`` from ``scheduler``. Please use ``parsing_processes`` from ``scheduler`` instead.
5+
* Removed deprecated configuration ``default_queue`` from ``celery``. Please use ``default_queue`` from ``operators`` instead.
6+
* Removed deprecated configuration ``hide_sensitive_variable_fields`` from ``admin``. Please use ``hide_sensitive_var_conn_fields`` from ``core`` instead.
7+
* Removed deprecated configuration ``sensitive_variable_fields`` from ``admin``. Please use ``sensitive_var_conn_names`` from ``core`` instead.
8+
* Removed deprecated configuration ``non_pooled_task_slot_count`` from ``core``. Please use ``default_pool_task_slot_count`` from ``core`` instead.
9+
* Removed deprecated configuration ``dag_concurrency`` from ``core``. Please use ``max_active_tasks_per_dag`` from ``core`` instead.
10+
* Removed deprecated configuration ``access_control_allow_origin`` from ``api``. Please use ``access_control_allow_origins`` from ``api`` instead.
11+
* Removed deprecated configuration ``auth_backend`` from ``api``. Please use ``auth_backends`` from ``api`` instead.
12+
* Removed deprecated configuration ``deactivate_stale_dags_interval`` from ``scheduler``. Please use ``parsing_cleanup_interval`` from ``scheduler`` instead.
13+
* Removed deprecated configuration ``worker_pods_pending_timeout_check_interval`` from ``kubernetes_executor``. Please use ``task_queued_timeout_check_interval`` from ``scheduler`` instead.
14+
* Removed deprecated configuration ``update_fab_perms`` from ``webserver``. Please use ``update_fab_perms`` from ``fab`` instead.
15+
* Removed deprecated configuration ``auth_rate_limited`` from ``webserver``. Please use ``auth_rate_limited`` from ``fab`` instead.
16+
* Removed deprecated configuration ``auth_rate_limit`` from ``webserver``. Please use ``auth_rate_limit`` from ``fab`` instead.
17+
* Removed deprecated configuration section ``kubernetes``. Please use ``kubernetes_executor`` instead.

tests/core/test_configuration.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353

5454
HOME_DIR = os.path.expanduser("~")
5555

56+
# The conf has been updated with deactivate_stale_dags_interval to test the functionality of deprecated options support.
57+
conf.deprecated_options[("scheduler", "parsing_cleanup_interval")] = (
58+
"scheduler",
59+
"deactivate_stale_dags_interval",
60+
"2.5.0",
61+
)
62+
5663

5764
@pytest.fixture(scope="module", autouse=True)
5865
def restore_env():
@@ -1002,14 +1009,6 @@ def test_deprecated_values_from_conf(self):
10021009
@pytest.mark.parametrize(
10031010
"old, new",
10041011
[
1005-
(
1006-
("api", "auth_backend", "airflow.providers.fab.auth_manager.api.auth.backend.basic_auth"),
1007-
(
1008-
"api",
1009-
"auth_backends",
1010-
"airflow.providers.fab.auth_manager.api.auth.backend.basic_auth,airflow.api.auth.backend.session",
1011-
),
1012-
),
10131012
(
10141013
("core", "sql_alchemy_conn", "postgres+psycopg2://localhost/postgres"),
10151014
("database", "sql_alchemy_conn", "postgresql://localhost/postgres"),

tests/providers/cncf/kubernetes/executors/test_kubernetes_executor.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def test_run_next_exception_requeue(
413413
mock_api_client.sanitize_for_serialization.return_value = {}
414414
mock_kube_client.api_client = mock_api_client
415415
config = {
416-
("kubernetes", "pod_template_file"): template_file,
416+
("kubernetes_executor", "pod_template_file"): template_file,
417417
}
418418
with conf_vars(config):
419419
kubernetes_executor = self.kubernetes_executor
@@ -513,7 +513,7 @@ def test_run_next_pod_reconciliation_error(
513513
mock_api_client = mock.MagicMock()
514514
mock_api_client.sanitize_for_serialization.return_value = {}
515515
mock_kube_client.api_client = mock_api_client
516-
config = {("kubernetes", "pod_template_file"): template_file}
516+
config = {("kubernetes_executor", "pod_template_file"): template_file}
517517
with conf_vars(config):
518518
kubernetes_executor = self.kubernetes_executor
519519
kubernetes_executor.start()
@@ -597,7 +597,7 @@ def test_pod_template_file_override_in_executor_config(
597597
mock_kube_client = mock.patch("kubernetes.client.CoreV1Api", autospec=True)
598598
mock_get_kube_client.return_value = mock_kube_client
599599

600-
with conf_vars({("kubernetes", "pod_template_file"): None}):
600+
with conf_vars({("kubernetes_executor", "pod_template_file"): None}):
601601
executor = self.kubernetes_executor
602602
executor.start()
603603
try:
@@ -1227,8 +1227,8 @@ def test_kube_config_get_namespace_list(
12271227
self, raw_multi_namespace_mode, raw_value_namespace_list, expected_value_in_kube_config
12281228
):
12291229
config = {
1230-
("kubernetes", "multi_namespace_mode"): raw_multi_namespace_mode,
1231-
("kubernetes", "multi_namespace_mode_namespace_list"): raw_value_namespace_list,
1230+
("kubernetes_executor", "multi_namespace_mode"): raw_multi_namespace_mode,
1231+
("kubernetes_executor", "multi_namespace_mode_namespace_list"): raw_value_namespace_list,
12321232
}
12331233
with conf_vars(config):
12341234
executor = KubernetesExecutor()
@@ -1504,7 +1504,7 @@ def test_annotations_for_logging_task_metadata(self):
15041504
}
15051505
get_logs_task_metadata.cache_clear()
15061506
try:
1507-
with conf_vars({("kubernetes", "logs_task_metadata"): "True"}):
1507+
with conf_vars({("kubernetes_executor", "logs_task_metadata"): "True"}):
15081508
expected_annotations = {
15091509
"dag_id": "dag",
15101510
"run_id": "run_id",
@@ -1525,7 +1525,7 @@ def test_annotations_for_logging_task_metadata_fallback(self):
15251525
}
15261526
get_logs_task_metadata.cache_clear()
15271527
try:
1528-
with conf_vars({("kubernetes", "logs_task_metadata"): "False"}):
1528+
with conf_vars({("kubernetes_executor", "logs_task_metadata"): "False"}):
15291529
expected_annotations = "<omitted>"
15301530
annotations_actual = annotations_for_logging_task_metadata(annotations_test)
15311531
assert annotations_actual == expected_annotations

tests/providers/cncf/kubernetes/test_client.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def test_disable_verify_ssl(self):
9292
assert not configuration.verify_ssl
9393

9494
@mock.patch("kubernetes.config.incluster_config.InClusterConfigLoader")
95-
@conf_vars({("kubernetes", "api_client_retry_configuration"): '{"total": 3, "backoff_factor": 0.5}'})
95+
@conf_vars(
96+
{("kubernetes_executor", "api_client_retry_configuration"): '{"total": 3, "backoff_factor": 0.5}'}
97+
)
9698
def test_api_client_retry_configuration_correct_values(self, mock_in_cluster_loader):
9799
get_kube_client(in_cluster=True)
98100
client_configuration = mock_in_cluster_loader().load_and_set.call_args.args[0]

0 commit comments

Comments
 (0)