Activate Apprise Persistent Storage for apache-airflow-providers-apprise
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 484
Description
### Description
My team is using Apprise to send notifications to Matrix from Airflow DAGs. We are using [the `apache-airflow-providers-apprise` package](https://airflow.apache.org/docs/apache-airflow-providers-apprise/stable/index.html) ([source code](https://github.com/apache/airflow/tree/main/providers/apprise/src/airflow/providers/apprise)), which in our case uses Apprise version 1.9.3.
When sending notifications this way we are quickly running into the login rate limit of our Matrix server. When sending these notifications via the Apprise CLI, this is not an issue, apparently thanks to [the Persistent Storage feature](https://github.com/caronc/apprise/wiki/persistent_storage) which caches the login data and avoids frequent re-logins.
Could Apprise's Persistent Storage be activated for the `apache-airflow-providers-apprise` package? I have requested and [obtained hints for implementing this from the Apprise developer](https://github.com/caronc/apprise/issues/1332#issuecomment-2909634835):
> It looks like this issue is in the `AppriseHook()` [here](https://github.com/apache/airflow/blob/0e87e058074f50c658edfed18060a4b43228dd69/providers/apprise/src/airflow/providers/apprise/hooks/apprise.py)
> ```
> apprise_obj = apprise.Apprise()
> ```
> Adjustment would need to be:
> ```
> # Prepare a location the persistent storage can write its cached content to.
> # By setting this path, this immediately assumes you wish to operate the
> # persistent storage in the operational 'auto' mode
> asset = apprise.AppriseAsset(storage_path="/path/to/save/data")
>
> # alternatively...
> asset = apprise.AppriseAsset(
> # Set our storage path directory (minimum requirement to enable it)
> storage_path="/path/to/save/data",
>
> # Set the mode... the options are:
> # 1. PersistentStoreMode.MEMORY
> # - disable persistent storage from writing to disk (default)
> # 2. PersistentStoreMode.AUTO
> # - write to disk on demand
> # 3. PersistentStoreMode.FLUSH
> # - write to disk always and often
> storage_mode=apprise.PersistentStoreMode.FLUSH
> )
>
> # Now that we've got our asset
> apprise_obj = apprise.Apprise(asset=asset)
> ```
### Use case/motivation
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
Contributor guide
Research direction
Start in providers/apprise/src/airflow/providers/apprise/hooks/apprise.py at the apprise.Apprise() call and compare it with Apprise 1.9.3 persistent-storage guidance. Determine how the provider should supply a writable storage_path and storage mode for Airflow deployments, then verify that Matrix notifications reuse cached login data without breaking existing hook behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100