Hello, I have a job that contains several assets. ...
# ask-community
l
Hello, I have a job that contains several assets. Each asset extract data with an API call. I would like to know if Dagster can launch a dbt task when it detects that every assets have finished their task. I have a constraint : If an asset fails I want to launch my dbt task anyway. Thank you for your help ! 🙂
t
Hi! Have you had an opportunity to look Run status sensors? If you make a job of your dbt models, then you can use a run status sensor for each of the different states (success or failure) to run your dbt job afterward. You can use a factory pattern to make your code more DRY and pass the states you want to listen to into it and generate a sensor per state.
l
Thanks. I didn't like sensors because I thought that I had to create two sensors. One if my job has failed and one if it has succeed. However, RunsFilter allowed me to get records in both cases.
Copy code
run_records = context.instance.get_run_records(
      filters=RunsFilter(
job_name="%%%",
statuses=[DagsterRunStatus.SUCCESS, DagsterRunStatus.FAILURE],
))