https://dagster.io/ logo
Title
g

Guillaume Latour

04/28/2023, 12:23 PM
Hello, I would like to add a metadata to all the asset materialization: e.g. the time it took to materialize the asset. Is there a simple way to achieve that? I am a bit lost and don't know which tool to use: asset materialization sensors/events? I guess that I should be able to achieve what I want by surrounding each function with a
time.time()
and add the difference in an output metadata. But it feels dirty. Thanks!
o

Odette Harary

04/28/2023, 1:20 PM
g

Guillaume Latour

04/28/2023, 1:24 PM
well yeah this will be nice to extract statistics, but here I'd like to add the time it took for each asset materialization so I can see this in the UI metadata graph
m

Marek Vigaš

05/22/2023, 3:01 PM
Hi @Odette Harary I have the same question as Guillaume. Also somebody asked this question on stackoverflow. Is there a way to avoid the boilerplate code ? For example dagster-dbt adds this out of box for every dbt asset.
g

Guillaume Latour

05/23/2023, 1:23 PM
it is possible to have an even simpler test case: the https://github.com/dagster-io/dagster/blob/master/examples/deploy_docker/repo.py also provide the "Execution Time" metadata. But I cant find which part of the code is responsible for it.
Hey @Marek Vigaš, did you find a way to avoid boilerplate code?