Sara
09/09/2021, 9:44 AMHi there!
I am new to Dagster and I need help.
I need to create a solid that has more than one outlet. I found an example in the documentation but I don't know how to apply it to a pipe.
This is an example of what I want to do, but I get an error trying to put it in the pipeline.
Thanks! :)
from dagster import solid, pipeline, OutputDefinition, Output
@solid(
output_defs=[
OutputDefinition(name="first_number"),
OutputDefinition(name="second_output"),
],
)
def multi_output_solid():
yield Output(5, output_name="first_number")
yield Output(6, output_name="second_number")
@solid
def add5(first_number):
result1 = first_number + 10
return result1
@solid
def add6(second_number):
result2 = second_number + 10
return result2
@solid
def total_add(result1, result2):
total_result = result1 + result2
return total_result
@pipeline
def my_pipeline():
first_number = "???" <------
second_number = "???" <------
total_add(add5(first_number), add6(second_number))
alex
09/09/2021, 2:32 PMfirst_number, second_number = multi_output_solid()
or via the output names:
outs = multi_output_solid()
outs.first_number
outs.second_number
or by index, but unlikely you want to do thatSara
09/13/2021, 8:38 AM