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

Danny Fraser

06/16/2022, 1:55 PM
How can I define a notebook as an asset? I've managed to follow the tutorial and examples to define one as an op, but would like to have it appear in the asset graph alongside the tables required for the output.
c

claire

06/16/2022, 6:27 PM
Hi Danny. We currently don't have native support to define dagstermill notebooks as assets. I can file an feature request for this though:
@Dagster Bot issue defined dagstermill notebook as asset
d

Dagster Bot

06/16/2022, 6:27 PM
c

claire

06/16/2022, 6:28 PM
A workaround you can try (not 100% sure if it will work) is wrapping the dagstermill op in a graph and using
AssetsDefinition.from_graph
to convert the graph to an asset:
Copy code
k_means_iris = dm.factory.define_dagstermill_op(
    "k_means_iris",
    script_relative_path("iris-kmeans.ipynb"),
    output_notebook_name="iris_kmeans_output",
)


@graph
def dagstermill_graph():
    return k_means_iris()

dagstermill_asset = AssetsDefinition.from_graph(dagstermill_graph)
❤️ 1
s

sandy

06/16/2022, 6:32 PM
I bet that the above will work!
d

Danny Fraser

06/17/2022, 7:26 AM
Brilliant, thanks to you both! I'll try that and see how it goes.
It worked! The graph looks perfect now. Still some issues with the notebook IO manager, but I'm sure I can figure that out.
blob cheer 2
v

Vladislav Goncharov

09/08/2022, 12:16 AM
@Danny Fraser did you find a way to resolve it? I still trying to resolve it with no success