shahar1 opened a new pull request, #74929:
URL: https://github.com/apache/airflow/pull/74929
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
related: #74926
<!-- HUMAN SUMMARY - AGENTS DO NOT MODIFY -->
When the Dag processor log directory is outside base_log_folder, AWS
CloudWatch raises ValueError and crashes before parsing the Dag.
This catches the error and keeps those lines local; verified on Airflow
3.3.2, where the Dag parsed and its triggered run succeeded.
<!-- END OF HUMAN SUMMARY -->
<details><summary>AI Summary</summary>
With Amazon CloudWatch remote logging, the Dag processor crashes on its
first log line when `[logging] dag_processor_child_process_log_directory`
points outside `[logging] base_log_folder`.
`CloudWatchRemoteLogIO.processors` calls `relative_path_from_logger`, which
uses `Path.relative_to` and raises `ValueError` for files outside
`base_log_folder`. Nothing on the way up catches it, so the exception ends the
Dag processor job and no Dag is parsed. `upload_to_remote` already skips such
files. The processor now does the same: it uses a wrapper that returns `None`
on `ValueError`, so these lines stay in the local log file and are not sent to
CloudWatch.
This is the same bug as the one in the Google Cloud Logging remote log IO,
which I reproduced on Airflow 3.3.2 (the Google change is in a separate PR).
Testing: the new unit test fails without the change, and the CloudWatch log
tests pass. I did not run this against a real AWS account; the crash path is
the one reproduced for the Google provider, in `relative_path_from_logger` and
the supervisor's log forwarding, which do not depend on the provider.
</details>
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Sonnet 5.5) 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.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]