-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Azure Service Bus Queue Operators #24038
Conversation
dddee2f
to
b20d782
Compare
airflow/providers/microsoft/azure/operators/azure_service_bus_queue.py
Outdated
Show resolved
Hide resolved
airflow/providers/microsoft/azure/operators/azure_service_bus_queue.py
Outdated
Show resolved
Hide resolved
airflow/providers/microsoft/azure/operators/azure_service_bus_queue.py
Outdated
Show resolved
Hide resolved
docs/apache-airflow-providers-microsoft-azure/connections/azure_service_bus.rst
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
tests/providers/microsoft/azure/operators/test_azure_service_queue.py
Outdated
Show resolved
Hide resolved
Docs are failing @bharanidharan14 check https://github.com/apache/airflow/runs/6970719258?check_suite_focus=true |
f93fb8b
to
9844f74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM and really close! Just some clarification on file naming and consistency with exceptions.
operations are enabled. | ||
""" | ||
if queue_name is None: | ||
raise ValueError("Queue name cannot be None.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError("Queue name cannot be None.") | |
raise TypeError("Queue name cannot be None.") |
Looks like there is a mix of TypeError
and ValueError
for the same exception. Let's stay consistent with Ash's initial feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving back to raise TypeError
:param queue_name: The name of the queue or a QueueProperties with name. | ||
""" | ||
if queue_name is None: | ||
raise ValueError("Queue name cannot be None.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError("Queue name cannot be None.") | |
raise TypeError("Queue name cannot be None.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving back to raise TypeError
:param max_wait_time: Maximum time to wait in seconds for the first message to arrive. | ||
""" | ||
if queue_name is None: | ||
raise ValueError("Queue name cannot be None.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError("Queue name cannot be None.") | |
raise TypeError("Queue name cannot be None.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving back to raise TypeError
self.dead_lettering_on_message_expiration, | ||
self.enable_batched_operations, | ||
) | ||
self.log.info("Created Queue ", queue.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.log.info("Created Queue ", queue.name) | |
self.log.info("Created Queue %s", queue.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@@ -0,0 +1,206 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eladkal What do you think about this file being named asb.py
instead?
@bharanidharan14 Unless you were thinking about there being some other Service Bus-related grouping of modules in the future that don't deal with messages, queues, etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josh-fell there is a draft PR for Azure service bus subscription operators (ASBCreateSubscriptionOperator, ASBUpdateSubscriptionOperator, ASBReceiveSubscriptionMessageOperator, ASBDeleteSubscriptionOperator) which uses the same hooks/asb.py
and for operator which I thought I can keep it under asb_subscription.py
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it make sense to group all operators under asb.py I'm OK with it but we don't have to.
My thumb rule for this is - it should be easily discoverable for users and easy to use.
In AWS for example, we grouped the S3 operators together because it's likely that in a single DAG you will need more than 1 operator so importing each operator from different file is annoying.
So the question here: how distinct are queue operators from subscriptions and how likely they are to be used in a single DAG? That is a question only people who use it can answer. Either way - we can always change it with some community feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message-sending functionality of a queue maps directly to a topic and its message-receiving functionality maps to a subscription, so there is a chance of user using the queue and subscription operators in the same DAG
https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions
Authenticating to Azure Service Bus | ||
------------------------------------ | ||
|
||
There are Multiple ways to authenticate and authorize access to Azure Service Bus resources: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are Multiple ways to authenticate and authorize access to Azure Service Bus resources: | |
There are multiple ways to authenticate and authorize access to Azure Service Bus resources: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed corrected with small letter
|
||
.. exampleinclude:: /../../tests/system/providers/microsoft/azure/example_service_bus_queue.py | ||
:language: python | ||
:dedent: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:dedent: 0 | |
:dedent: 4 |
Since the START
markers are indented, we should dedent the rendered code snippet in the docs. Same comment applies to the other instances as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected with :dedent: 4
2c2a5b1
to
33d5797
Compare
@josh-fell I have addressed the review comments, please review it |
@bharanidharan14 There are test failures:
|
@kaxil fixed it and pushed it again. Thanks |
b35474f
to
e62e125
Compare
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
b89f85e
to
34833b8
Compare
Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's - Rename file name - changed the import and got all the sub class into same file to maintain the existing structure - fixed the testcase Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's - Test case - Doc string - Removed airflow exception and added proper error type - Removed try/expect block - Renamed the azure service bus queue operator test file Implement Azure Service Bus Queue Operator's Add Azure Service Bus Queue Operator's - Create Queue Operator - Send message queue Operator - Receive message queue Operator - Delete queue Operator - example DAG - Added hooks and connection type in - provider yaml file - Added unit Test case Update example DAG Add Operators documentation - Fixed `connection_string` to be part of `get_conn()` not as Class attr - Fixed connection doc - changed the start date in example DAG - Added Documentation on the Azure service bus Operators Add space for the doc string Fix - Fixed ValueError to TypeError - Fixed log info - corrected `:dedent: 4` Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's - Rename file name - changed the import and got all the sub class into same file to maintain the existing structure - fixed the testcase Implement Azure Service Bus Queue Operator's Implement Azure Service Bus Queue Operator's - Test case - Doc string - Removed airflow exception and added proper error type - Removed try/expect block - Renamed the azure service bus queue operator test file Implement Azure Service Bus Queue Operator's Add Azure Service Bus Queue Operator's - Create Queue Operator - Send message queue Operator - Receive message queue Operator - Delete queue Operator - example DAG - Added hooks and connection type in - provider yaml file - Added unit Test case Update example DAG Add Operators documentation - Fixed `connection_string` to be part of `get_conn()` not as Class attr - Fixed connection doc - changed the start date in example DAG - Added Documentation on the Azure service bus Operators Add space for the doc string Fix - Fixed ValueError to TypeError - Fixed log info - corrected `:dedent: 4` Add log info Fix Test case failure Rename the azure_queue to asb
e5df1e9
to
170f026
Compare
Implemented Azure Service Bus Queue based Operator's to create queue, send message to the queue and receive message(list of message or batch message) and delete queue in azure service
AzureServiceBusCreateQueueOperator
AzureServiceBusSendMessageOperator
AzureServiceBusReceiveMessageOperator
AzureServiceBusDeleteQueueOperator
cc: @kaxil @phanikumv