diff --git a/airflow/cli/cli_config.py b/airflow/cli/cli_config.py index 43c853a060d94..508a18263d48e 100644 --- a/airflow/cli/cli_config.py +++ b/airflow/cli/cli_config.py @@ -321,15 +321,6 @@ def string_lower_type(val): ), action="store_true", ) -ARG_BF_IGNORE_FIRST_DEPENDS_ON_PAST = Arg( - ("-I", "--ignore-first-depends-on-past"), - help=( - "Ignores depends_on_past dependencies for the first " - "set of tasks only (subsequent executions in the backfill " - "DO respect depends_on_past)" - ), - action="store_true", -) ARG_POOL = Arg(("--pool",), "Resource pool to use") ARG_DELAY_ON_LIMIT = Arg( ("--delay-on-limit",), @@ -383,11 +374,6 @@ def string_lower_type(val): action="store_true", ) -ARG_TREAT_DAG_AS_REGEX = Arg( - ("--treat-dag-as-regex",), - help=("Deprecated -- use `--treat-dag-id-as-regex` instead"), - action="store_true", -) ARG_TREAT_DAG_ID_AS_REGEX = Arg( ("--treat-dag-id-as-regex",), @@ -1230,7 +1216,6 @@ class GroupCommand(NamedTuple): ARG_CONTINUE_ON_FAILURES, ARG_DISABLE_RETRY, ARG_BF_IGNORE_DEPENDENCIES, - ARG_BF_IGNORE_FIRST_DEPENDS_ON_PAST, ARG_SUBDIR, ARG_POOL, ARG_DELAY_ON_LIMIT, @@ -1240,7 +1225,6 @@ class GroupCommand(NamedTuple): ARG_RESET_DAG_RUN, ARG_RERUN_FAILED_TASKS, ARG_RUN_BACKWARDS, - ARG_TREAT_DAG_AS_REGEX, ARG_TREAT_DAG_ID_AS_REGEX, ), ), diff --git a/airflow/cli/commands/dag_command.py b/airflow/cli/commands/dag_command.py index d89be8b589f73..1796f6cab15e3 100644 --- a/airflow/cli/commands/dag_command.py +++ b/airflow/cli/commands/dag_command.py @@ -26,7 +26,6 @@ import signal import subprocess import sys -import warnings from typing import TYPE_CHECKING import re2 @@ -37,7 +36,7 @@ from airflow.api_connexion.schemas.dag_schema import dag_schema from airflow.cli.simple_table import AirflowConsole from airflow.configuration import conf -from airflow.exceptions import AirflowException, RemovedInAirflow3Warning +from airflow.exceptions import AirflowException from airflow.jobs.job import Job from airflow.models import DagBag, DagModel, DagRun, TaskInstance from airflow.models.dag import DAG @@ -133,22 +132,8 @@ def dag_backfill(args, dag: list[DAG] | DAG | None = None) -> None: """Create backfill job or dry run for a DAG or list of DAGs using regex.""" logging.basicConfig(level=settings.LOGGING_LEVEL, format=settings.SIMPLE_LOG_FORMAT) signal.signal(signal.SIGTERM, sigint_handler) - if args.ignore_first_depends_on_past: - warnings.warn( - "--ignore-first-depends-on-past is deprecated as the value is always set to True", - category=RemovedInAirflow3Warning, - stacklevel=4, - ) args.ignore_first_depends_on_past = True - if not args.treat_dag_id_as_regex and args.treat_dag_as_regex: - warnings.warn( - "--treat-dag-as-regex is deprecated, use --treat-dag-id-as-regex instead", - category=RemovedInAirflow3Warning, - stacklevel=4, - ) - args.treat_dag_id_as_regex = args.treat_dag_as_regex - if not args.start_date and not args.end_date: raise AirflowException("Provide a start_date and/or end_date") diff --git a/newsfragments/41739.significant.rst b/newsfragments/41739.significant.rst new file mode 100644 index 0000000000000..51947218eeec5 --- /dev/null +++ b/newsfragments/41739.significant.rst @@ -0,0 +1,3 @@ +Removed backfill job command cli option ``ignore-first-depends-on-past``. Its value always set to True. No replcaement cli option. + +Removed backfill job command cli option ``treat-dag-as-regex``. Please use ``treat-dag-id-as-regex`` instead. diff --git a/tests/cli/commands/test_dag_command.py b/tests/cli/commands/test_dag_command.py index d8322f27dd5df..9c0a129d46ead 100644 --- a/tests/cli/commands/test_dag_command.py +++ b/tests/cli/commands/test_dag_command.py @@ -35,7 +35,7 @@ from airflow.cli import cli_parser from airflow.cli.commands import dag_command from airflow.decorators import task -from airflow.exceptions import AirflowException, RemovedInAirflow3Warning +from airflow.exceptions import AirflowException from airflow.models import DagBag, DagModel, DagRun from airflow.models.baseoperator import BaseOperator from airflow.models.dag import _run_inline_trigger @@ -247,24 +247,6 @@ def test_backfill(self, mock_run): assert f"Dry run of DAG example_branch_operator on {DEFAULT_DATE_REPR}\n" in output assert "Task run_this_first located in DAG example_branch_operator\n" in output - @mock.patch("airflow.cli.commands.dag_command._run_dag_backfill") - def test_backfill_treat_dag_as_regex_deprecation(self, _): - run_date = DEFAULT_DATE + timedelta(days=1) - cli_args = self.parser.parse_args( - [ - "dags", - "backfill", - "example_bash_operator", - "--treat-dag-as-regex", - "--start-date", - run_date.isoformat(), - ] - ) - - with pytest.warns(DeprecationWarning, match="--treat-dag-as-regex is deprecated"): - dag_command.dag_backfill(cli_args) - assert cli_args.treat_dag_id_as_regex == cli_args.treat_dag_as_regex - @mock.patch("airflow.cli.commands.dag_command.get_dag") def test_backfill_fails_without_loading_dags(self, mock_get_dag): cli_args = self.parser.parse_args(["dags", "backfill", "example_bash_operator"]) @@ -331,15 +313,8 @@ def test_show_dag_imgcat(self, mock_render_dag, mock_popen): assert "OUT" in out assert "ERR" in out - @pytest.mark.parametrize( - "cli_arg", - [ - pytest.param("-I", id="short"), - pytest.param("--ignore-first-depends-on-past", id="full"), - ], - ) @mock.patch("airflow.cli.commands.dag_command.DAG.run") - def test_cli_backfill_deprecated_ignore_first_depends_on_past(self, mock_run, cli_arg: str): + def test_cli_backfill_ignore_first_depends_on_past(self, mock_run): """ Test that CLI respects -I argument @@ -355,12 +330,10 @@ def test_cli_backfill_deprecated_ignore_first_depends_on_past(self, mock_run, cl "--local", "--start-date", run_date.isoformat(), - cli_arg, ] dag = self.dagbag.get_dag(dag_id) - with pytest.warns(RemovedInAirflow3Warning, match="ignore-first-depends-on-past is deprecated"): - dag_command.dag_backfill(self.parser.parse_args(args), dag=dag) + dag_command.dag_backfill(self.parser.parse_args(args), dag=dag) mock_run.assert_called_once_with( start_date=run_date,