amoghrajesh opened a new pull request, #77862:
URL: https://github.com/apache/airflow/pull/77862
<!-- 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".
-->
- [x] 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)
-->
Follow-up to #76514.
`stop_taking_output()` must run before `cleanup_sockets_after_kill()`, or
the drain can hang on a trigger's child process that keeps writing. Only
`_execute` calls it, so it is now private and named after what it does:
`_shutdown_socket_reads()`. It has not shipped in a release or been backported
yet, so the rename breaks nobody.
I kept the `SHUT_RD` step in the triggerer instead of moving it into the
task-sdk drain. Moving it would also change the Dag processor's `close()`, and
airflow-core would then need a newer task-sdk for the fix to hold.
Tests:
- The drain test used a real subprocess, a thread, a 1 ms sleep and a 5 s
join, so it could fail on a slow CI runner. The reader now refills the socket
on every read, as a child that never stops writing would. Without `SHUT_RD` the
drain never ends and the test fails after 1000 reads. No subprocess, thread or
sleep.
- The end-to-end shutdown test wrote into the real `base_log_folder` and
left files behind. It now uses `tmp_path` through `conf_vars`, gives the remote
handler mock `spec=RemoteLogIO`, and fails with a clear message if the trigger
never starts.
- Dropped the failing-upload case from
`test_close_trigger_log_files_uploads_every_trigger_log`. That isolation is in
`_upload_and_close`, which this code did not change.
- Removed comments that repeated the reason in `_execute`.
---
* 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]