Skip to content

Add hook for amazonmsk#69000

Open
arnoldmr01 wants to merge 1 commit into
apache:mainfrom
arnoldmr01:add-hook-for-amazonmsk
Open

Add hook for amazonmsk#69000
arnoldmr01 wants to merge 1 commit into
apache:mainfrom
arnoldmr01:add-hook-for-amazonmsk

Conversation

@arnoldmr01

@arnoldmr01 arnoldmr01 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

Integrate Amazon MSK for user to have variety way to implement Event-Driven Scheduling feature which has been introduced in Airflow 3.0
related: #52712

What is changed in this PR?

This PR add a hook for Amazon MSK. We only make this hook as an interface for creating an authenticated MSK boto3 client so far.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
  • Codex

  • Read the 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) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@arnoldmr01
arnoldmr01 marked this pull request as ready for review June 30, 2026 07:32
@arnoldmr01
arnoldmr01 requested a review from o-nikolas as a code owner June 30, 2026 07:32

@o-nikolas o-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the methods look like single line wrappers around the boto API. It seems like we don't have much of a usecase for this? Curious to hear what @vincbeck and @ferruzzi have to say about this one.

Comment thread providers/amazon/pyproject.toml Outdated
# in the `devel-dependencies` section to be the same minimum version.
"boto3>=1.41.0",
"botocore>=1.41.0",
"aws-msk-iam-sasl-signer-python>=1.0.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of this is optional in the code as you've written it, but it's included as a mandatory dependency here. Let's move this below to be an optional dependency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will modify it later

@o-nikolas o-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd probably have to bump the botocore minimum since these are new APIs?

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

uv.lock on main just moved via #68933 ("[main] Upgrade important CI environment"), commit e0a1726 and this PR currently conflicts.

Quickest fix:

git fetch upstream main && git rebase upstream/main
rm uv.lock && uv lock
git add uv.lock && git rebase --continue
git push --force-with-lease

Automated nudge — ignore if you're not ready to rebase. This comment is updated in place on future uv.lock bumps.

@arnoldmr01
arnoldmr01 marked this pull request as draft July 1, 2026 03:44
@ferruzzi

ferruzzi commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Agreed with Niko. Looks like the hooks are generally replacing one-liners with functions, which we generally avoid.

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM overall.

Most of the methods look like single line wrappers around the boto API. It seems like we don't have much of a usecase for this?

I agreed with this point as well. We could make the MSK Hook itself just the interface to retrieve the authenticated MSK client with given conn_id.

Same as the AwaitMessageTrigger (the Kafka concusmer in Airlfow trigger) implementation, we will leverage the SDK client that retrieved via connection directly without additional wrapper.

async def run(self):
consumer_hook = KafkaConsumerHook(topics=self.topics, kafka_config_id=self.kafka_config_id)
async_get_consumer = sync_to_async(consumer_hook.get_consumer)
self._consumer = await async_get_consumer()
async_poll = sync_to_async(self._consumer.poll)
async_commit = sync_to_async(self._consumer.commit)

@vincbeck vincbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I dont think these methods are needed. They do not add much value, in the task/operator you can directly invoke boto3 the same way you do it in the hook

@arnoldmr01

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing. I agree that these methods are not necessary. I will follow @jason810496 comment and modify the PR and make it focus on retrieving authenticated MSK client

@arnoldmr01
arnoldmr01 force-pushed the add-hook-for-amazonmsk branch 6 times, most recently from deba9d9 to 016dcca Compare July 19, 2026 23:48
@arnoldmr01
arnoldmr01 force-pushed the add-hook-for-amazonmsk branch from 016dcca to 3d68ddd Compare July 20, 2026 07:12
@arnoldmr01
arnoldmr01 marked this pull request as ready for review July 20, 2026 07:54
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 20, 2026

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers kind:documentation provider:amazon AWS/Amazon - related issues ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants