Saul Burgos
08/29/2022, 9:01 PMfrom dagster import job, op, Nothing, In, graph
@op
def op1(context) -> Nothing:
<http://context.log.info|context.log.info>("op1")
return
@op(ins={"start": In(Nothing)})
def op2(context) -> Nothing:
<http://context.log.info|context.log.info>("op2")
return
@op(
ins={"x": In(Nothing), "y": In(Nothing)}
)
def op3(context) -> Nothing:
<http://context.log.info|context.log.info>("op3")
return
@graph
def graph1() -> Nothing:
return op2(op1())
@graph
def graph2() -> Nothing:
return op2(op1())
@graph(
input_defs=[
InputDefinition("x", Nothing),
InputDefinition("y", Nothing)
]
)
def graph3(x: Nothing, y: Nothing) -> Nothing:
return op3(x=x, y=y)
@job
def main():
graph3(
graph1(),
graph2(),
)
jamie
08/29/2022, 10:13 PMInputDefinition
is deprecated as of 1.0, but there is a known bug with graphs. We have an issue to track this and it should be out in this week's release https://github.com/dagster-io/dagster/issues/9531
After this fix gets released you'll be able to use In
instead of InputDefinition
Saul Burgos
08/30/2022, 1:16 PMSaul Burgos
09/07/2022, 9:26 PMjamie
09/07/2022, 9:29 PMSaul Burgos
09/07/2022, 9:35 PM@op
def op1(context) -> Nothing:
print("op1")
return
@op(ins={"start": In(Nothing)})
def op2(context) -> Nothing:
print("op2")
return
@graph()
def graph1() -> Nothing:
op2(op1())
return
@graph()
def graph2() -> Nothing:
op2(op1())
return
@graph(
ins={"x": GraphIn(), "y": GraphIn()}
)
def graph3(x, y) -> Nothing:
pass
@job
def the_job():
graph3(
graph1(),
graph2(),
)
@repository
def core_generic():
definitions = [
the_job
]
return definitions
jamie
09/09/2022, 3:13 PMsandy
09/11/2022, 6:06 PMinput_defs=[
InputDefinition("x", Nothing),
InputDefinition("y", Nothing)
]
if that doesn't work, what error are you hitting?Saul Burgos
09/12/2022, 1:29 PM