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

   As it landed on main, a loop's gate only recorded a go/no-go decision for
   the next iteration, meaning the UI could show that a loop stopped after N
   iterations, but a user would have to go to the logs to find out why,
   exactly, the loop ended when it did.
   
   This adds a `LoopDecision` object that lets an `until` callable include
   human-readable text to show alongside its decision.
   
   As well as introducing this new type, it also changes how the decision
   makes it to the server. Prior to this change, the decision was shipped to
   the API server via a specially named XCom value, in a normal SetXCom
   request, which was then read when the gate's TISuccessState request
   arrived. That "worked", but was inherently fragile: a separate write
   with its own locking, validation and cleanup on every non-success path.
   
   The decision now travels on the gate's terminal state update. The server
   acts on it in the transaction that marks the gate finished, so the
   stop/continue signal never needs storing. A gate that fails because until
   stayed false at max_iterations sends its reason with the failure, which is
   when an explanation helps most.
   
   Only the reason is persisted, as an XCom on the gate's attempt that the
   server writes in that same transaction. Keying it to the attempt means
   each try keeps its own reason, and a cleared or retried gate starts with
   none, so no clear path has to remember to delete a stale one. Task state
   was considered instead, but it is keyed by the iteration rather than the
   attempt, so a reason outlived the clears and tries it described, and
   clear_on_success and retention could remove it. The server writes the
   XCom directly to the metadata DB (not to a configured backend, so the UI
   can always show it), and the reserved `_airflow_loop_` prefix stops users
   and tasks forging it. The XCom list endpoint leaves those keys out when
   asked, which the UI does.
   
   * Show loop decision reasons in the UI
   
   A finished loop's page shows the reason its final iteration gave, and every
   task instance in an iteration shows that iteration's reason. The iteration
   pickers are left alone because their rows are one-line labels.
   
   A reason can run to 512 bytes over several lines, which pushed the header
   stats around, so the headers cut it to one line and the tooltip shows it
   in full.
   
   (cherry picked from commit 4c4bab01e0635933fde25f8be14613112d1e2b05)
   
    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull 
request.
   Write a good git commit message following this guide: 
https://chris.beams.io/posts/git-commit/
   
   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.
   
   For user-facing UI changes, please attach before/after screenshots (or a 
short
   screen recording) so reviewers can assess the visual impact.
   
   Feel free to ping (in general) for the review if you do not see reaction for 
a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we 
sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change below checkbox to `[X]` followed by the name of the tool, uncomment 
the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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

Reply via email to