Skip to content

Activate Apprise Persistent Storage for apache-airflow-providers-apprise #51102

@wolfgesbro

Description

@wolfgesbro

Description

My team is using Apprise to send notifications to Matrix from Airflow DAGs. We are using the apache-airflow-providers-apprise package (source code), 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 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:

It looks like this issue is in the AppriseHook() here

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions