khuyentran1401 / prefect-alert

A decorator that sends alert when a Prefect flow fails
https://khuyentran1401.github.io/prefect-alert/
Apache License 2.0
13 stars 3 forks source link

Add type wrapper #2

Closed rpeden closed 2 years ago

rpeden commented 2 years ago

This pull request adds a wrapper class that helps this decorator do what it needs to do while still passing the type check that is currently causing it to fail when run in a deployment, as mentioned in https://github.com/PrefectHQ/prefect/issues/7338. The update in this PR makes the decorator usable without requiring changes to Prefect.

Example

@alert_on_failure(block_type=SlackWebhook, block_name="test")
@flow
def test_flow():
    print("testing")

isinstance(test_flow, Flow)
---> returns True

Checklist

ahuang11 commented 2 years ago

This is an awesome idea!