You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dheerajturaga (via GitHub)" <gi...@apache.org> on 2025/09/15 17:03:15 UTC

[PR] Add Dag ID pattern search functionality to Dag Runs and Task Instances [airflow]

dheerajturaga opened a new pull request, #55691:
URL: https://github.com/apache/airflow/pull/55691

     - Add dag_id_pattern query parameter to DAG runs and task instances API endpoints
     - Implement SQL LIKE pattern matching with % and _ wildcards
     - Add search fields to DAG runs and task instances UI pages with conditional display
     - Update TypeScript client with new dag_id_pattern parameters
     - Add comprehensive unit tests for DAG ID pattern filtering
     - Fix test to use existing example DAGs instead of non-existent ones
   
   
   https://github.com/user-attachments/assets/a6b9d804-ad26-40e9-9894-3aa43461d840
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Dag ID pattern search functionality to Dag Runs and Task Instances [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #55691:
URL: https://github.com/apache/airflow/pull/55691#discussion_r2355368339


##########
airflow-core/src/airflow/ui/src/pages/DagRuns.tsx:
##########
@@ -275,9 +278,36 @@ export const DagRuns = () => {
     [pagination, searchParams, setSearchParams, setTableURLState, sorting],
   );
 
+  const handleDagIdPatternChange = useCallback(
+    (value: string) => {
+      if (value === "") {
+        searchParams.delete(DAG_ID_PATTERN_PARAM);
+      } else {
+        searchParams.set(DAG_ID_PATTERN_PARAM, value);
+      }
+      setTableURLState({
+        pagination: { ...pagination, pageIndex: 0 },
+        sorting,
+      });
+      setSearchParams(searchParams);
+    },
+    [pagination, searchParams, setSearchParams, setTableURLState, sorting],
+  );
+
   return (
     <>
       <HStack paddingY="4px">
+        {dagId === undefined && (
+          <Box>
+            <SearchBar
+              defaultValue={filteredDagIdPattern ?? ""}
+              hideAdvanced
+              hotkeyDisabled={true}
+              onChange={handleDagIdPatternChange}
+              placeHolder="Search by Dag ID"

Review Comment:
   Same here, translated placeholder.



##########
airflow-core/src/airflow/ui/src/pages/TaskInstances/TaskInstancesFilter.tsx:
##########
@@ -80,8 +85,34 @@ export const TaskInstancesFilter = ({
     setSearchParams(searchParams);
   };
 
+  const handleDagIdPatternChange = useCallback(
+    (value: string) => {
+      if (value === "") {
+        searchParams.delete(DAG_ID_PATTERN_PARAM);
+      } else {
+        searchParams.set(DAG_ID_PATTERN_PARAM, value);
+      }
+      setTableURLState({
+        pagination: { ...pagination, pageIndex: 0 },
+        sorting,
+      });
+      setSearchParams(searchParams);
+    },
+    [pagination, searchParams, setSearchParams, setTableURLState, sorting],
+  );
+
   return (
     <HStack paddingY="4px">
+      {dagId === undefined && (
+        <SearchBar
+          buttonProps={{ disabled: true }}
+          defaultValue={filteredDagIdPattern ?? ""}
+          hideAdvanced
+          hotkeyDisabled={true}
+          onChange={handleDagIdPatternChange}
+          placeHolder="Search by Dag ID"

Review Comment:
   This placeholder should be translated (`search.dags`)



##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -1401,6 +1401,46 @@ def test_should_respond_200_for_pagination(self, test_client, session):
         assert (num_entries_batch1 + num_entries_batch2) == ti_count
         assert response_batch1 != response_batch2
 
+    def test_dag_id_pattern_filter(self, test_client, session):

Review Comment:
   Nit: Similarly to what you did for `dag_runs` this should be part of the `test_should_respond_200` test which tests all the query params (filter, search and all). So all of them are grouped together. 
   
   I don't think we need an extra specific test. 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Dag ID pattern search functionality to Dag Runs and Task Instances [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on code in PR #55691:
URL: https://github.com/apache/airflow/pull/55691#discussion_r2358736087


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -1401,6 +1401,46 @@ def test_should_respond_200_for_pagination(self, test_client, session):
         assert (num_entries_batch1 + num_entries_batch2) == ti_count
         assert response_batch1 != response_batch2
 
+    def test_dag_id_pattern_filter(self, test_client, session):

Review Comment:
   Done!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Dag ID pattern search functionality to Dag Runs and Task Instances [airflow]

Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on code in PR #55691:
URL: https://github.com/apache/airflow/pull/55691#discussion_r2358736613


##########
airflow-core/src/airflow/ui/src/pages/TaskInstances/TaskInstancesFilter.tsx:
##########
@@ -80,8 +85,34 @@ export const TaskInstancesFilter = ({
     setSearchParams(searchParams);
   };
 
+  const handleDagIdPatternChange = useCallback(
+    (value: string) => {
+      if (value === "") {
+        searchParams.delete(DAG_ID_PATTERN_PARAM);
+      } else {
+        searchParams.set(DAG_ID_PATTERN_PARAM, value);
+      }
+      setTableURLState({
+        pagination: { ...pagination, pageIndex: 0 },
+        sorting,
+      });
+      setSearchParams(searchParams);
+    },
+    [pagination, searchParams, setSearchParams, setTableURLState, sorting],
+  );
+
   return (
     <HStack paddingY="4px">
+      {dagId === undefined && (
+        <SearchBar
+          buttonProps={{ disabled: true }}
+          defaultValue={filteredDagIdPattern ?? ""}
+          hideAdvanced
+          hotkeyDisabled={true}
+          onChange={handleDagIdPatternChange}
+          placeHolder="Search by Dag ID"

Review Comment:
   Done!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Dag ID pattern search functionality to Dag Runs and Task Instances [airflow]

Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 merged PR #55691:
URL: https://github.com/apache/airflow/pull/55691


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Dag ID pattern search functionality to Dag Runs and Task Instances [airflow]

Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on code in PR #55691:
URL: https://github.com/apache/airflow/pull/55691#discussion_r2349884394


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -1401,6 +1401,46 @@ def test_should_respond_200_for_pagination(self, test_client, session):
         assert (num_entries_batch1 + num_entries_batch2) == ti_count
         assert response_batch1 != response_batch2
 
+    def test_dag_id_pattern_filter(self, test_client, session):

Review Comment:
   It would be nice to refactor the test with `parameterize`.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org