Skip to content

Commit c2ed791

Browse files
author
coder2j
authored
Merge pull request #1 from coder2j/dev
feature/video2-build-asset-graph
2 parents 1dbf5c7 + 8d7506f commit c2ed791

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

hello-dagster.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
1-
from dagster import asset, AssetExecutionContext
1+
from typing import List
2+
from dagster import asset, AssetExecutionContext, AssetIn
23

34

4-
@asset
5+
@asset(key="my_awesome_first_asset", group_name="get_started")
56
def my_first_asset(context: AssetExecutionContext):
67
"""
78
This is our first asset for testing purposes
89
"""
910
print("this is a print message.")
1011
context.log.info("this is a log message.")
1112
return [1, 2, 3]
13+
14+
15+
@asset(ins={"upstream": AssetIn(key="my_awesome_first_asset")}, group_name="get_started")
16+
def my_second_asset(context: AssetExecutionContext, upstream: List):
17+
"""
18+
This is our second asset
19+
"""
20+
data = upstream + [4, 5, 6]
21+
context.log.info(f"Output data is: {data}")
22+
return data
23+
24+
25+
@asset(ins={
26+
"first_upstream": AssetIn("my_awesome_first_asset"),
27+
"second_upstream": AssetIn("my_second_asset")
28+
}, group_name="get_started")
29+
def my_third_asset(
30+
context: AssetExecutionContext,
31+
first_upstream: List,
32+
second_upstream: List):
33+
"""
34+
This is our third asset
35+
"""
36+
data = {
37+
"first_asset": first_upstream,
38+
"second_asset": second_upstream,
39+
"third_asset": second_upstream + [7, 8]
40+
}
41+
context.log.info(f"Output data is: {data}")
42+
return data

0 commit comments

Comments
 (0)