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

[PR] fix: Add auto-refresh functionality to Required Actions page [airflow]

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

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   related: #56081 
   
   - Add useAutoRefresh hook to HITLTaskInstances component
   - Pass refetchInterval to useTaskInstanceServiceGetHitlDetails query
   - Enable automatic refresh every 3 seconds for HITL task instances
   - Resolves issue where Required Actions list required manual F5 refresh
   
   thanks for review.
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -148,6 +152,19 @@ export const HITLTaskInstances = () => {
     state: effectiveResponseReceived === "false" ? ["deferred"] : undefined,
     taskId,
     taskIdPattern,
+  }, undefined, {
+    // Only continue auto-refetching when filtering for unreceived responses
+    // and at least one TaskInstance is still deferred without a response.
+    refetchInterval: (query) => {
+      const isFilteringUnreceived = effectiveResponseReceived === "false";
+      if (!isFilteringUnreceived) return false;

Review Comment:
   We should make this based only on the `query.state.data`



-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #56404:
URL: https://github.com/apache/airflow/pull/56404#issuecomment-3384904027

   @bbovenzi  hanks for the suggestion! I switched the fixed refetch interval to a conditional one:
   auto‑refresh is enabled only when filtering with response_received=false. after each fetch, we check whether hitl_details still contains any items with no responded_at and state === 'deferred'. if none remain, we return false to stop polling.


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #56404:
URL: https://github.com/apache/airflow/pull/56404#issuecomment-3437414818

   > CI is still failing, do you mind fixing it so we can merge the PR.
   
   No problem, I'll try! Thanks!


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -148,6 +152,8 @@ export const HITLTaskInstances = () => {
     state: effectiveResponseReceived === "false" ? ["deferred"] : undefined,
     taskId,
     taskIdPattern,
+  }, undefined, {
+    refetchInterval,

Review Comment:
   @bbovenzi ... hmhm reading your comment - this would mean if all actions are "finished then the page is not updating anymore. But if the user for approval opens the list and a second later a new request is generated it might be the user is waiting until he hits F5 to refresh.. if on initial opening the list was empty/completed.
   
   I am also in favor not endless polling but might be confusing if refresh stops and then only F5 can force an update.



-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #56404:
URL: https://github.com/apache/airflow/pull/56404#issuecomment-3397101177

   Thanks @bbovenzi , I removed effectiveResponseReceived only use  the query.state.data


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #56404:
URL: https://github.com/apache/airflow/pull/56404#issuecomment-3449434090

   Thanks for everyone!


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #56404:
URL: https://github.com/apache/airflow/pull/56404#issuecomment-3444134161

   Manual backport https://github.com/apache/airflow/pull/57207


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -148,6 +152,8 @@ export const HITLTaskInstances = () => {
     state: effectiveResponseReceived === "false" ? ["deferred"] : undefined,
     taskId,
     taskIdPattern,
+  }, undefined, {
+    refetchInterval,

Review Comment:
   > To avoid endless fetching, we should add a check to only refetch if there are details without response_received and TaskInstance is still deferred
   
   That's implemented like this atm, lets try and we can always revisit if we feel like it.



-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -127,6 +128,9 @@ export const HITLTaskInstances = () => {
   const [sort] = sorting;
   const responseReceived = searchParams.get(RESPONSE_RECEIVED_PARAM);
 
+  // Add auto-refresh functionality

Review Comment:
   ```suggestion
   ```



##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -148,6 +152,17 @@ export const HITLTaskInstances = () => {
     state: effectiveResponseReceived === "false" ? ["deferred"] : undefined,
     taskId,
     taskIdPattern,
+  }, undefined, {
+    // Only continue auto-refetching when filtering for unreceived responses
+    // and at least one TaskInstance is still deferred without a response.
+    refetchInterval: (query) => {
+      const hasDeferredWithoutResponse = Boolean(
+        query.state.data?.hitl_details?.some(
+          (detail: HITLDetail) => !detail.responded_at && detail.task_instance.state === "deferred",
+        ),
+      );
+      return hasDeferredWithoutResponse ? baseRefetchInterval : false;
+    },

Review Comment:
   CI is failing, there's two typescript errors there.



-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #56404:
URL: https://github.com/apache/airflow/pull/56404#issuecomment-3444101783

   ### Backport failed to create: v3-1-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/18786696899'> Run details </a>
   
   <table>
       <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>❌</td>
           <td>v3-1-test</td>
           <td><a href="https://github.com/apache/airflow/commit/9adb256aba3344747a2d7a25842c61af89bd7bc3"><img src='https://img.shields.io/badge/Commit-9adb256-red' alt='Commit Link'></a></td>
       </tr>
   </table>
   
   You can attempt to backport this manually by running:
   
   ```bash
   cherry_picker 9adb256 v3-1-test
   ```
   
   This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
   the files that need manual conflict resolution.
   
   After you have resolved the conflicts, you can continue the backport process by running:
   
   ```bash
   cherry_picker --continue
   ```
   


-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -148,6 +152,8 @@ export const HITLTaskInstances = () => {
     state: effectiveResponseReceived === "false" ? ["deferred"] : undefined,
     taskId,
     taskIdPattern,
+  }, undefined, {
+    refetchInterval,

Review Comment:
   To avoid endless fetching, we should add a check to only refetch if there are details without `response_received` and TaskInstance is still deferred



-- 
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] fix: Add auto-refresh functionality to Required Actions page [airflow]

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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -148,6 +152,8 @@ export const HITLTaskInstances = () => {
     state: effectiveResponseReceived === "false" ? ["deferred"] : undefined,
     taskId,
     taskIdPattern,
+  }, undefined, {
+    refetchInterval,

Review Comment:
   Yeah, thats true. Maybe we are making this too complicated for ourselves.



-- 
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