SameerMesiah97 commented on code in PR #66884:
URL: https://github.com/apache/airflow/pull/66884#discussion_r3238385288
##########
airflow-core/tests/unit/cli/commands/test_task_command.py:
##########
@@ -541,6 +541,48 @@ def test_task_render_for_multi_line_properties(self,
dag_maker):
# no indentation before property name
assert "# property: bash_command" in output.split("\n")
+ def test_task_clear_with_dag_regex_returns_serialized_dags(self):
+ """
+ ``tasks clear --dag-regex`` should resolve matching Dags via the
serialized Dag
+ table so that ``SerializedDAG.clear_dags`` can call ``.clear()`` on
them.
+
+ Regression test for the regex branch of ``get_dags(from_db=True)``:
previously
+ it ignored ``from_db`` and parsed bundles off disk, returning SDK
``DAG``
+ objects (no ``.clear`` method) and causing ``AttributeError``
downstream.
+
+ Note: despite the ``--dag-regex`` name, the implementation calls
+ ``re.search(pattern, dag_id)`` — unanchored, so a plain string like
+ ``"example_python"`` matches any dag_id containing that substring.
+ """
Review Comment:
This docstring is too verbose. I would suggest the below:
"""
Regression test for ``get_dags(..., from_db=True)`` with ``use_regex=True``.
Previously the regex path ignored ``from_db`` and returned SDK ``DAG``
objects instead of serialized DAGs, causing ``task_clear`` to fail
when calling ``.clear()`` downstream.
"""
--
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]