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

Slackbot

09/07/2022, 12:50 PM
This message was deleted.
s

Stephen Bailey

09/07/2022, 2:03 PM
that error looks like the op/asset is yielding an output named
sixth_dbt
, but the only output available is
third_dbt
.
l

Lorenzo

09/07/2022, 2:04 PM
but what does this mean? these dependencies have always worked and are really, really simple
s

Stephen Bailey

09/07/2022, 2:04 PM
do you do any explicit naming of assets?
l

Lorenzo

09/07/2022, 2:05 PM
Yes, for example:
Copy code
dbt_assets_1 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="first_dbt")
dbt_assets_2 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="second_dbt")
dbt_assets_3 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="third_dbt")
s

Stephen Bailey

09/07/2022, 2:05 PM
ah, i see. where is
sixth_dbt
coming from?
and why would it be getting confused with
third_dbt
? maybe there are assets named identically?
l

Lorenzo

09/07/2022, 2:07 PM
sixth_dbt, comes from second_dbt here is the code:
Copy code
/*{{ config(materialized='view') }}*/

{{ config(
    tags='advertisement'
) }}

select *
from {{ ref("second_dbt") }}
and third comes as well from second, they are two branches of the dag
💡 1
s

Stephen Bailey

09/07/2022, 2:10 PM
gotcha, so these are models in the dbt project. so your
dbt_run_project
job is materializing all the indvidual assets in the dbt project. and that specific op is yielding an asset key that doesn't exist (or something). My first thought is that maybe
sixth_dbt
is not able to run correctly in the dbt project? Does the model run okay?
l

Lorenzo

09/07/2022, 2:11 PM
If I run
dbt run
, everything works perfectly in a few seconds. :(
To me it looks like that, when i create two branches from a node, one of them goes right, and the other one always returns this error
s

Stephen Bailey

09/07/2022, 2:13 PM
yeah, i think what might be happening is that when you load the assets multiple times, duplicate entries get created for assets that are named the same thing. if you just did
Copy code
dbt_assets = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR)
once, without a
select
, i wonder if that would work.
❤️ 1
( i haven't done any work with the dbt assets stuff myself)
l

Lorenzo

09/07/2022, 2:13 PM
It's frustrating because this same project was running smoothly until few weeks ago, I just cloned my own code without changing anything
🤷 1
s

Stephen Bailey

09/07/2022, 2:14 PM
great time to deprecate a dbt model 😉
l

Lorenzo

09/07/2022, 2:15 PM
I am going to try this solution, maybe you just lit up the light bulb in my brain ahahaha
🌈 1
Ok so update: the presentation went great and this (dbt_assets = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR)) worked fine so: thank you @Stephen Bailey yay The only problem left is that, by importing all assets at once, I can't restart a "broken" dag from the point of failure. When I choose "restart from failure", dagster restarts the whole tree from the first node. It would be great to import all the assets easily AND also repeat only the failed nodes when needed 👀
🌈 1
s

Stephen Bailey

09/07/2022, 5:10 PM
woo! i think the "restart from failure" problem is endemic to the limitations of dbt / the integration. dagster would need to be smart enough to run
dbt run --select failed_model+
dynamically to accommodate it. One thing you might be able to do instead is to go to Global Asset Graph > select
failed_models+
in the selector, then run a new job
yay 1
l

Lorenzo

09/07/2022, 5:30 PM
Later I am going to try this! You are so kind, thank you! 🤩🙏🏻
blob highfive 1
y

yuhan

09/07/2022, 5:53 PM
cc @owen regarding restart from failure w/ dbt assets
❤️ 1
o

owen

09/07/2022, 6:00 PM
ah that's a good point about restart from failure -- right now the button in the UI purely restarts from the failed ops, but because all of the dbt models run in the same operation (dbt run), this results in the behavior you're experiencing. One thing we're considering adding to the job / global asset graph pages is a "rematerialize failed assets" button (naming tbd), which would streamline the process that @Stephen Bailey’s describing (because you wouldn't need to manually come up with that asset selection). As it stands now though, that's what I'd recommend doing 🙂
❤️ 1
l

Lorenzo

09/08/2022, 11:02 AM
Thank you @owen, @yuhan and again @Stephen Bailey. I am looking forward to this function. It would be absolutely perfect for my company!
Hi @owen yay, do you have any news about the "restart from failure" function? I came back on the dagster project for my company and we are still looking for this exact function. It would be the cherry on the cake for what I am trying to do. 🌈
o

owen

01/13/2023, 5:44 PM
hi @Lorenzo! It's not quite a "restart from failure" button, but there is now a "rematerialize stale assets" button in the UI, which should work for this use case -- essentially, assets whose parents have been materialized more recently than they have been are marked as stale, and you can run just those stale assets from the UI. If a dbt run fails halfway though, then the assets that did not get materialized will all be "stale" (as their parents were rematerialized, but they weren't), so this should, in most cases, be the selection you want.
❤️ 1
2 Views