You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "utkarsharma2 (via GitHub)" <gi...@apache.org> on 2023/05/25 04:37:40 UTC
[GitHub] [airflow] utkarsharma2 opened a new pull request, #31533: Add Apprise Provider
utkarsharma2 opened a new pull request, #31533:
URL: https://github.com/apache/airflow/pull/31533
<!--
Thank you for contributing! 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.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1218117422
##########
airflow/providers/apprise/provider.yaml:
##########
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-apprise
+
+name: Apprise
+
+description: |
+ `Apprise <https://github.com/caronc/apprise>`__
+
+suspended: false
+
+versions:
+ - 1.0.0
+
+integrations:
+ - integration-name: Apprise
+ external-doc-url: https://github.com/caronc/apprise
+ tags: [software]
+
+dependencies:
+ - apache-airflow>=2.2.0
Review Comment:
something is odd here...
This doesn't match to
```
"deps": [
"apache-airflow>=2.4.0",
"apprise"
],
```
that you have on `generated/provider_dependencies.json`
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1235783708
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
To be honest - I have no idea either. The errors that we had are generated by Sphinx and theorethically it should have been complaining about missing index - but it does not. I don't even have hypothesis why it's doing that
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1218123346
##########
airflow/providers/apprise/provider.yaml:
##########
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-apprise
+
+name: Apprise
+
+description: |
+ `Apprise <https://github.com/caronc/apprise>`__
+
+suspended: false
+
+versions:
+ - 1.0.0
+
+integrations:
+ - integration-name: Apprise
+ external-doc-url: https://github.com/caronc/apprise
+ tags: [software]
+
+dependencies:
+ - apache-airflow>=2.2.0
Review Comment:
Yes. Pre-commits should be run for this change (static checks are failing because they weren't).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1213896806
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
+
+Package apache-airflow-providers-apprise
+-----------------------------------------
+
+`Apprise <https://github.com/caronc/apprise>`__
+
+
+Release: 1.0.0
+
+Provider package
+----------------
+
+This is a provider package for ``apprise`` provider. All classes for this provider package
+are in ``airflow.providers.apprise`` python package.
+
+
+Requirements
+------------
+
+The minimum Apache Airflow version supported by this provider package is ``2.4.0``.
+
+================== ==================
+PIP package Version required
+================== ==================
+``apache-airflow`` ``>=2.2.0``
Review Comment:
didn't know the provider's reason. Thanks. :)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236241812
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
@eladkal @eladkal Just noticed we already have a link to `notifications/apprise_notifier_howto_guide` in line 79. Do we still need to mention this explicitly?
~~In [32006](https://github.com/apache/airflow/pull/32006) I guess it was missing this altogether, right?~~
the link was there in PR.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236241812
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
@eladkal @eladkal Just noticed we already have a link to `notifications/apprise_notifier_howto_guide` in line 79. Do we still need to mention this explicitly?
In [32006](https://github.com/apache/airflow/pull/32006) I guess it was missing this altogether, right?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] jedcunningham commented on pull request #31533: Add Apprise Provider
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on PR #31533:
URL: https://github.com/apache/airflow/pull/31533#issuecomment-1569274707
Lazy consensus was reached in https://lists.apache.org/thread/2gh845jb8k0nlvzpqdm4pk1t44djhs92
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1213916124
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
Review Comment:
I'm not sure if I understand the question correctly, but it can be any file type, I have updated the type hint for the same.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1222748227
##########
airflow/providers/apprise/provider.yaml:
##########
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-apprise
+
+name: Apprise
+
+description: |
+ `Apprise <https://github.com/caronc/apprise>`__
+
+suspended: false
+
+versions:
+ - 1.0.0
+
+integrations:
+ - integration-name: Apprise
+ external-doc-url: https://github.com/caronc/apprise
+ tags: [software]
+
+dependencies:
+ - apache-airflow>=2.2.0
Review Comment:
@eladkal @potiuk the static issues are resolved and `provider.yaml` is updated as well, please take a look
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236704083
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
We dont have such connection set in db/utils
We probably need a seperated PR to core to add it.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236891857
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
Just to clarify: It won't be found in the list of default connections which are created with "init" (which we actually discourage for production):
From https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/production-deployment.html#database-backend
> Do not use `airflow db init` as it can create a lot of default connections, charts, etc. which are not required in production DB.
And the drop-down will be visiable when provider is installed (new connection types are provided by the provider being installed not by default connection created by initi).
I am not sure if we need to do that in Apprise docs, but maybe a separate documentation in general on how those things work and how default_* connections are created would be more useful ?
Just to clarify behaviours and what to expect.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236925706
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
agreed
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk merged pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #31533:
URL: https://github.com/apache/airflow/pull/31533
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236891857
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
Just to clarify: It won't be found in the list of default connections which are created with "init" (which we actually discourage for production).
From https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/production-deployment.html#database-backend
> Do not use airflow db init as it can create a lot of default connections, charts, etc. which are not required in production DB.
And the drop-down will be visiable when provider is installed (new connection types are provided by the provider being installed not by default connection created by initi).
I am not sure if we need to do that in Apprise docs, but maybe a separate documentation in general on how those things work and how default_* connections are created would be more useful ?
Just to clarify behaviours and what to expect.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1213915772
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
Review Comment:
Yup, done.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236803687
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
I'll address that post we merge this PR :)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1235324995
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
There is a missing link to the notifier hotow
I don't know why/how the doc build is missing it but this will cause failures when we try to release the provider. Like we had for https://github.com/apache/airflow/pull/32006
@potiuk this is interesting case that I can't explain. I would have expected the doc build to fail on this PR
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1213916124
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
Review Comment:
It can be any filetype, I have updated the type hint for the same.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236888771
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
@eladkal I'm sorry I didn't understand.
If someone is using airflow - 2.4.0
1. Without Apprise providers, generic connections won't be useful because the provider code is not there to understand what needs to be done with the generic connection
2. With Apprise provide you will have a connection type, which you can directly use therefore no need for a generic connection.
I'm sure I missed something here?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236909319
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
Ya, I think a general document would be better, will also cater to all providers as well. I can raise a PR for the same.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] jedcunningham commented on a diff in pull request #31533: Add Apprise Provider
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1212592395
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
+
+Package apache-airflow-providers-apprise
+-----------------------------------------
+
+`Apprise <https://github.com/caronc/apprise>`__
+
+
+Release: 1.0.0
+
+Provider package
+----------------
+
+This is a provider package for ``apprise`` provider. All classes for this provider package
+are in ``airflow.providers.apprise`` python package.
+
+
+Requirements
+------------
+
+The minimum Apache Airflow version supported by this provider package is ``2.4.0``.
+
+================== ==================
+PIP package Version required
+================== ==================
+``apache-airflow`` ``>=2.2.0``
Review Comment:
Short version: 2.4 is the minimum supported Airflow version for providers
https://github.com/apache/airflow/blob/main/PROVIDERS.rst#minimum-supported-version-of-airflow-for-community-managed-providers
Why 2.4 vs 2.6 since this is primarily for the notifier? Well, the hook can be used in 2.4 and 2.5.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236449306
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
@potiuk Yup, I agree sorry didn't check in with other providers earlier. Updated it. :)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236891857
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
Just to clarify: It won't be found in the list of default connections which are created with "init" (which we actually discourage for production):
From https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/production-deployment.html#database-backend
> Do not use `airflow db init` as it can create a lot of default connections, charts, etc. which are not required in production DB.
And the drop-down will be visiable when provider is installed (new connection types are provided by the provider being installed not by default connection created by `airflow db init`).
I am not sure if we need to do that in Apprise docs, but maybe a separate documentation in general on how those things work and how default_* connections are created would be more useful ?
Just to clarify behaviours and what to expect.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] jedcunningham commented on a diff in pull request #31533: Add Apprise Provider
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1218099068
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
Review Comment:
Type hint works!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1218117422
##########
airflow/providers/apprise/provider.yaml:
##########
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-apprise
+
+name: Apprise
+
+description: |
+ `Apprise <https://github.com/caronc/apprise>`__
+
+suspended: false
+
+versions:
+ - 1.0.0
+
+integrations:
+ - integration-name: Apprise
+ external-doc-url: https://github.com/caronc/apprise
+ tags: [software]
+
+dependencies:
+ - apache-airflow>=2.2.0
Review Comment:
something is odd here...
There doesn't match to
```
"deps": [
"apache-airflow>=2.4.0",
"apprise"
],
```
that you have on `generated/provider_dependencies.json`
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1213907165
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
+ :param interpret_escapes: Enable interpretation of backslash escapes. For example, this would convert
+ sequences such as \n and \r to their respected ascii new-line and carriage
+ :param config: Specify one or more configuration
+ """
+ title = title or ""
+
+ apprise_obj = apprise.Apprise()
+ if config:
+ apprise_obj.add(config)
Review Comment:
Not sure TBH, but I think a connection can serve as default, and in some cases where you want to override some config you can.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1218114717
##########
airflow/providers/apprise/provider.yaml:
##########
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-apprise
+
+name: Apprise
+
+description: |
+ `Apprise <https://github.com/caronc/apprise>`__
+
+suspended: false
+
+versions:
+ - 1.0.0
+
+integrations:
+ - integration-name: Apprise
+ external-doc-url: https://github.com/caronc/apprise
+ tags: [software]
+
+dependencies:
+ - apache-airflow>=2.2.0
Review Comment:
This is not right.
min version needs to be 2.4.0
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] jedcunningham commented on a diff in pull request #31533: Add Apprise Provider
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1210939825
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,42 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
Review Comment:
```suggestion
.. _howto/connection:apprise:
```
So we can link here...
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
Review Comment:
```suggestion
def __init__(self, apprise_conn_id: str = default_conn_name) -> None:
```
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
Review Comment:
```suggestion
:param title: Specify the message title. (optional)
```
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
+ :param interpret_escapes: Enable interpretation of backslash escapes. For example, this would convert
+ sequences such as \n and \r to their respected ascii new-line and carriage
Review Comment:
```suggestion
sequences such as \n and \r to their respective ascii new-line and carriage return characters
```
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
Review Comment:
Might be better to not use a raw string and just escape the 2 slashes.
##########
generated/provider_dependencies.json:
##########
@@ -201,6 +201,14 @@
"cross-providers-deps": [],
"excluded-python-versions": []
},
+ "apprise": {
+ "deps": [
+ "apache-airflow>=2.2.0",
Review Comment:
```suggestion
"apache-airflow>=2.4.0",
```
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
+ :param interpret_escapes: Enable interpretation of backslash escapes. For example, this would convert
+ sequences such as \n and \r to their respected ascii new-line and carriage
+ :param config: Specify one or more configuration
+ """
+ title = title or ""
+
+ apprise_obj = apprise.Apprise()
+ if config:
+ apprise_obj.add(config)
Review Comment:
Hmm, is this a common pattern we support, not using a connection?
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
Review Comment:
```suggestion
raise ValueError(f"Only types of dict or list[dict] are expected in Apprise connections, got {type(config_object)}")
```
Let's be a little more specific.
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
Review Comment:
```suggestion
Use Apprise(https://github.com/caronc/apprise) to interact with notification services.
The complete list of notification services supported by Apprise can be found at:
https://github.com/caronc/apprise/wiki#notification-services
```
nit, plus a better link for supported services
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
Review Comment:
If this supports more than 1, is it csv? Let's say.
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
+
+Package apache-airflow-providers-apprise
+-----------------------------------------
+
+`Apprise <https://github.com/caronc/apprise>`__
+
+
+Release: 1.0.0
+
+Provider package
+----------------
+
+This is a provider package for ``apprise`` provider. All classes for this provider package
+are in ``airflow.providers.apprise`` python package.
Review Comment:
```suggestion
This is a provider package for ``apprise`` notification library. All classes for this provider package
are in ``airflow.providers.apprise`` python module.
```
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
+
+Package apache-airflow-providers-apprise
+-----------------------------------------
+
+`Apprise <https://github.com/caronc/apprise>`__
+
+
+Release: 1.0.0
+
+Provider package
+----------------
+
+This is a provider package for ``apprise`` provider. All classes for this provider package
+are in ``airflow.providers.apprise`` python package.
+
+
+Requirements
+------------
+
+The minimum Apache Airflow version supported by this provider package is ``2.4.0``.
+
+================== ==================
+PIP package Version required
+================== ==================
+``apache-airflow`` ``>=2.2.0``
Review Comment:
```suggestion
``apache-airflow`` ``>=2.4.0``
```
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
Review Comment:
```suggestion
:param apprise_conn_id: :ref:`Apprise connection id <howto/connection:apprise>`
that has services configured in the `config` field.
"""
```
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
+ :param interpret_escapes: Enable interpretation of backslash escapes. For example, this would convert
+ sequences such as \n and \r to their respected ascii new-line and carriage
+ :param config: Specify one or more configuration
+ """
+ title = title or ""
+
+ apprise_obj = apprise.Apprise()
+ if config:
+ apprise_obj.add(config)
+ else:
+ self.set_config_from_conn(apprise_obj)
+ apprise_obj.notify(
+ body=body,
+ title=title,
+ notify_type=notify_type,
+ body_format=body_format,
+ tag=tag,
+ attach=attach,
+ interpret_escapes=interpret_escapes,
+ )
+
+ def get_conn(self) -> None:
+ pass
Review Comment:
I wonder if we should raise here instead?
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,42 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications, the entire list of services supported can be found `here <https://github.com/caronc/apprise#supported-notifications>`_.
Review Comment:
```suggestion
The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on a diff in pull request #31533: Add Apprise Provider
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236852454
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
We probably need however some doc notice about it because users of Airflow 2.4.0 for example won't have this default connection nor they will find apprise in the drop list..
so we probably need to explain how to setup the connection for them (using generic_connection?)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236236163
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
@eladkal @potiuk Added missing link for Apprise Notification.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236424438
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
Review Comment:
Ah.. That would explain why it worked :) - I think it's better to move it to the toc tree above from the end @utkarsharma2 - as it might confuse things and also when docs is generated ? In most other provider toc trees are in the same part of .rst file.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236891857
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
Just to clarify: It won't be found in the list of default connections which are created with "init" (which we actually discourage. And the drop-down will be visiable when provider is installed (new connection types are provided by the provider being installed not by default connection created by initi).
I am not sure if we need to do that in Apprise docs, but maybe a separate documentation in general on how those things work and how default_* connections are created would be more useful ?
Just to clarify behaviours and what to expect.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1212538013
##########
docs/apache-airflow-providers-apprise/index.rst:
##########
@@ -0,0 +1,77 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+``apache-airflow-providers-apprise``
+======================================
+
+Content
+-------
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Guides
+
+ Connection types <connections>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Commits
+
+ Detailed list of commits <commits>
+
+
+.. toctree::
+ :maxdepth: 1
+ :caption: Resources
+
+ Python API <_api/airflow/providers/apprise/index>
+ PyPI Repository <https://pypi.org/project/apache-airflow-providers-apprise/>
+ Installing from sources <installing-providers-from-sources>
+
+Package apache-airflow-providers-apprise
+-----------------------------------------
+
+`Apprise <https://github.com/caronc/apprise>`__
+
+
+Release: 1.0.0
+
+Provider package
+----------------
+
+This is a provider package for ``apprise`` provider. All classes for this provider package
+are in ``airflow.providers.apprise`` python package.
+
+
+Requirements
+------------
+
+The minimum Apache Airflow version supported by this provider package is ``2.4.0``.
+
+================== ==================
+PIP package Version required
+================== ==================
+``apache-airflow`` ``>=2.2.0``
Review Comment:
@jedcunningham Just curious, why 2.4.0??
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1213905345
##########
airflow/providers/apprise/hooks/apprise.py:
##########
@@ -0,0 +1,127 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+from typing import Any, Iterable
+
+import apprise
+from airflow.hooks.base import BaseHook
+from apprise import AppriseConfig, NotifyFormat, NotifyType
+
+
+class AppriseHook(BaseHook):
+ """
+ Use Apprise(https://github.com/caronc/apprise) to interact with notification services, the entire list
+ of notification services supported by apprise can be found here
+ - https://github.com/caronc/apprise#productivity-based-notifications
+ """
+
+ conn_name_attr = "apprise_conn_id"
+ default_conn_name = "apprise_default"
+ conn_type = "apprise"
+ hook_name = "Apprise"
+
+ def __init__(self, apprise_conn_id: str = default_conn_name):
+ super().__init__()
+ self.apprise_conn_id = apprise_conn_id
+
+ def get_config_from_conn(self):
+ conn = self.get_connection(self.apprise_conn_id)
+ return json.loads(conn.extra_dejson["config"])
+
+ def set_config_from_conn(self, apprise_obj: apprise.Apprise):
+ """Set config from connection to apprise object"""
+ config_object = self.get_config_from_conn()
+ if isinstance(config_object, list):
+ for config in config_object:
+ apprise_obj.add(config["path"], tag=config.get("tag", None))
+ elif isinstance(config_object, dict):
+ apprise_obj.add(config_object["path"], tag=config_object.get("tag", None))
+ else:
+ raise ValueError("only dict / list[dict] type of values are expected")
+
+ def notify(
+ self,
+ body: str,
+ title: str | None = None,
+ notify_type: NotifyType = NotifyType.INFO,
+ body_format: NotifyFormat = NotifyFormat.TEXT,
+ tag: str | Iterable[str] | None = None,
+ attach: str | None = None,
+ interpret_escapes: bool | None = None,
+ config: AppriseConfig | None = None,
+ ):
+ r"""
+ Send message to plugged-in services
+
+ :param body: Specify the message body
+ :param title: Specify the message title. This field is complete optional
+ :param notify_type: Specify the message type (default=info). Possible values are "info",
+ "success", "failure", and "warning"
+ :param body_format: Specify the input message format (default=text). Possible values are "text",
+ "html", and "markdown".
+ :param tag: Specify one or more tags to filter which services to notify
+ :param attach: Specify one or more file attachment locations
+ :param interpret_escapes: Enable interpretation of backslash escapes. For example, this would convert
+ sequences such as \n and \r to their respected ascii new-line and carriage
+ :param config: Specify one or more configuration
+ """
+ title = title or ""
+
+ apprise_obj = apprise.Apprise()
+ if config:
+ apprise_obj.add(config)
+ else:
+ self.set_config_from_conn(apprise_obj)
+ apprise_obj.notify(
+ body=body,
+ title=title,
+ notify_type=notify_type,
+ body_format=body_format,
+ tag=tag,
+ attach=attach,
+ interpret_escapes=interpret_escapes,
+ )
+
+ def get_conn(self) -> None:
+ pass
Review Comment:
Yup, I think it's always better to fail loudly.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31533: Add Apprise Provider
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1236891857
##########
docs/apache-airflow-providers-apprise/connections.rst:
##########
@@ -0,0 +1,43 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. _howto/connection:apprise:
+
+Apprise Connection
+=======================
+
+The Apprise connection type enables connection to multiple services to send notifications. The complete list of services supported can be found on the `Apprise Wiki <https://github.com/caronc/apprise/wiki#notification-services>`_.
+
+Default Connection IDs
+----------------------
+
+Apprise hooks point to ``apprise_default`` by default.
Review Comment:
Just to clarify: It won't be found in the list of default connections which are created with "init" (which we actually discourage for production):
From https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/production-deployment.html#database-backend
> Do not use airflow db init as it can create a lot of default connections, charts, etc. which are not required in production DB.
And the drop-down will be visiable when provider is installed (new connection types are provided by the provider being installed not by default connection created by initi).
I am not sure if we need to do that in Apprise docs, but maybe a separate documentation in general on how those things work and how default_* connections are created would be more useful ?
Just to clarify behaviours and what to expect.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] utkarsharma2 commented on a diff in pull request #31533: Add Apprise Provider
Posted by "utkarsharma2 (via GitHub)" <gi...@apache.org>.
utkarsharma2 commented on code in PR #31533:
URL: https://github.com/apache/airflow/pull/31533#discussion_r1222748227
##########
airflow/providers/apprise/provider.yaml:
##########
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-apprise
+
+name: Apprise
+
+description: |
+ `Apprise <https://github.com/caronc/apprise>`__
+
+suspended: false
+
+versions:
+ - 1.0.0
+
+integrations:
+ - integration-name: Apprise
+ external-doc-url: https://github.com/caronc/apprise
+ tags: [software]
+
+dependencies:
+ - apache-airflow>=2.2.0
Review Comment:
@eladkal @potiuk the static issues are resolved and `provider.yaml` is updated as well, please take a look.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org