-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello_kedro.py
56 lines (42 loc) · 1.43 KB
/
hello_kedro.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Contents of hello_kedro.py"""
# prerequisite
# kedro jupyter convert notebooks/generationCopy1.ipynb
from kedro.io import DataCatalog, MemoryDataSet
from kedro.pipeline import node, Pipeline
from kedro.runner import SequentialRunner
from src.kedro_bioimage.nodes.generationCopy1 import generation
# Prepare a data catalog
data_catalog = DataCatalog({"example_data": MemoryDataSet()})
# Prepare first node
def return_greeting():
return "Hello"
return_greeting_node = node(
return_greeting, inputs=None, outputs="my_salutation"
)
# Prepare second node
def join_statements(greeting):
return f"{greeting} Kedro!"
join_statements_node = node(
join_statements, inputs="my_salutation", outputs="my_message"
)
#
# adder_node = node(
# func=add, inputs=["a", "b"], outputs="sum"
# )
generation_node = node(
generation, inputs=["num_samples"], outputs=None
)
# Assemble nodes into a pipeline
#pipeline = Pipeline([return_greeting_node, join_statements_node])
#pipeline = Pipeline([return_greeting_node])
pipeline = Pipeline([generation_node])
# Create a runner to run the pipeline
runner = SequentialRunner()
# Run the pipeline
#print(runner.run(pipeline, data_catalog))
#print(runner.run(pipeline, DataCatalog(dict(a=2,b=3))))
#io = DataCatalog(dict(a=MemoryDataSet(),b=MemoryDataSet()))
io = DataCatalog(dict(num_samples=MemoryDataSet()))
io.save("num_samples",1)
# print(adder_node.run(dict(a=2, b=3)))
print(runner.run(pipeline, io))