I've just discovered the `allow_failure` utility - is there something similar to invoke only when a...
l
I've just discovered the
allow_failure
utility - is there something similar to invoke only when an upstream task fails? My use case is a flow running dbt models, I want to run failed models when the original task fails
1
Or would this just be at try except?
Or something like this:
Copy code
state = trigger_dbt_cli_command(
        command="dbt build -s +tag:mytags+",
        **trigger_kwargs,
        wait_for=[deps],
    )

    if state.is_failed():
        trigger_dbt_cli_command(
            command="dbt build -s +tag:mytags+ result:error+ --defer --state ./targets",
            **trigger_kwargs,
            wait_for=[allow_failure(state)],
        )
z
You’d need to add
return_state=True
to that first call
but yeah you can use if statements looking at the state or try/except retrieving the result
👍 1