Skip to content

fix(providers/amazon): handle multi-node job log streams in BatchClientHook - #63476

Merged
potiuk merged 2 commits into
apache:mainfrom
antonio-mello-ai:fix/batch-multinode-awslogs
Mar 14, 2026
Merged

fix(providers/amazon): handle multi-node job log streams in BatchClientHook#63476
potiuk merged 2 commits into
apache:mainfrom
antonio-mello-ai:fix/batch-multinode-awslogs

Conversation

@antonio-mello-ai

Copy link
Copy Markdown
Contributor

Summary

  • Fix get_job_all_awslogs_info() to extract log stream names from both single-node (attempts[].container.logStreamName) and multi-node (attempts[].taskProperties[].containers[].logStreamName) AWS Batch job schemas
  • Filter out None values that previously bypassed the if not stream_names: guard, causing TypeError in urllib.parse.quote_plus() downstream

Root Cause

Multi-node AWS Batch jobs return log stream names under attempts[].taskProperties[].containers[].logStreamName, not the single-node path attempts[].container.logStreamName. The existing code only checked the single-node path, producing stream_names = [None] for multi-node jobs. Since [None] is truthy, it passed the emptiness guard and propagated None downstream.

Test Plan

  • New test: multi-node job with taskProperties schema extracts stream names correctly
  • New test: multi-node job with no logStreamName in container falls through to warning path
  • All 41 tests pass (39 existing + 2 new)
  • All pre-commit hooks pass (prek)

Closes #54254

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…ntHook

Multi-node AWS Batch jobs return log stream names under
`attempts[].taskProperties[].containers[].logStreamName` instead of
the single-node path `attempts[].container.logStreamName`. The existing
code only checked the single-node path, producing `[None]` for
multi-node jobs which bypassed the emptiness guard and caused a
TypeError in urllib.parse.quote_plus() downstream.

Now extracts stream names from both schemas and filters out None values.

Closes apache#54254

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Mar 12, 2026
Skip multi-node iteration when single-node stream is already found,
as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@potiuk

potiuk commented Mar 13, 2026

Copy link
Copy Markdown
Member

@o-nikolas — Could you please check whether your review feedback on this PR has been addressed? @antonio-mello-ai appears to have responded to your comments. @antonio-mello-ai, do you believe the reviewer's concerns have been resolved?

If the concerns are resolved, please resolve the conversation threads. Thank you!

@antonio-mello-ai

Copy link
Copy Markdown
Contributor Author

@potiuk Yes, the reviewer's concern has been addressed — added continue in 85432c7 as @o-nikolas suggested. I've resolved the conversation thread. Thanks for following up!

@potiuk
potiuk merged commit c5e77ce into apache:main Mar 14, 2026
92 checks passed
@o-nikolas

Copy link
Copy Markdown
Contributor

Just getting back to this monday, looks all good to me

abhijeets25012-tech pushed a commit to abhijeets25012-tech/airflow that referenced this pull request Apr 9, 2026
…ntHook (apache#63476)

* fix(providers/amazon): handle multi-node job log streams in BatchClientHook

Multi-node AWS Batch jobs return log stream names under
`attempts[].taskProperties[].containers[].logStreamName` instead of
the single-node path `attempts[].container.logStreamName`. The existing
code only checked the single-node path, producing `[None]` for
multi-node jobs which bypassed the emptiness guard and caused a
TypeError in urllib.parse.quote_plus() downstream.

Now extracts stream names from both schemas and filters out None values.

Closes apache#54254

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add continue after single-node stream match

Skip multi-node iteration when single-node stream is already found,
as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS BatchOperator fails to get log links for multi-node jobs

3 participants