https://dagster.io/ logo
#ask-community
Title
# ask-community
r

Romain

05/05/2022, 1:53 PM
Hello everyone! Is there a way to attach a hook to a job built from a software-defined asset?
dagster bot resolve to issue 1
p

prha

05/05/2022, 2:50 PM
Hi Romain. If you are looking for a way to fire an alert or perform some action based on a run failure of an asset job, you can set up a run status sensor. You can point it at a specific job, including an asset job. For example,
Copy code
from dagster import asset, build_assets_job, run_failure_sensor

@asset
def asset1():
    return 1

@asset
def asset2():
    return 2

my_asset_job = build_assets_job("my_assets_job", assets=[asset1, asset2])

@run_failure_sensor(job_selection=[my_asset_job])
def perform_on_asset_job_failure(context):
    ...
r

Romain

05/05/2022, 2:52 PM
Yep that's the one, thanks a lot!
p

prha

05/06/2022, 5:30 PM
@Dagster Bot discussion Adding run failure sensors to software-defined asset jobs
d

Dagster Bot

05/06/2022, 5:30 PM
Question in the thread has been surfaced to GitHub Discussions for future discoverability: https://github.com/dagster-io/dagster/discussions/7774
2 Views