Hey Dagsters! I have a beginner issue. I have 2 gr...
# ask-community
a
Hey Dagsters! I have a beginner issue. I have 2 graphs. Each graph has a number of ops. I want to run them sequentially. I have tried something along those lines:
Copy code
@op
def op1():
   return None
@graph
def graph1():
   op1()
@op
def op2():
   return None
@graph(ins={"start_after": In(Nothing)})
def graph2(start_after):
   op2()
@job
def runner():
   graph2(start_after=graph1())
But I am getting
Copy code
dagster.core.errors.DagsterInvalidDefinitionError: @graph 'graph2' has unmapped input 'start_after'. Remove it or pass it to the appropriate solid invocation.
Is this even possible? I have tried a number of things along those lines. I am trying to avoid importing a big number of
ops
to compose everything in 1 go. Any help would be very much appreciated. Thanks!!!
b
Aris, I did something similar. I had to define the output of the preceding ops, in addition to the input for the subsequent ones.
Copy code
@op(out={"clear": Out(Nothing)})
def first_op():
    pass

@op(ins={"clear": In(Nothing)})
def second_op():
    pass
a
Thanks Ben, I will give it a go! Did you get this to work with
@graph
, or just with
@op
?
b
I did not use graphs, but a job orchestrates the ops and it works
The error message is telling you that
start_after
is undefined, so defining it as the output made sense to me
a
I will try to wrap my head around it. Thanks!
Copy code
@op
def op1():
    return None

@graph(out={"clear": GraphOut()})
def graph1():
    return op1()

@op(ins={"clear": In(Nothing)})
def op2():
    return None

@graph(ins={"clear": GraphIn()})
def graph2(clear):
    op2(clear)

@job
def runner():
    graph2(graph1())
Got it to work! Graph needs to pass
Nothing
around as this is how Dagster tracks dependencies. Thanks Ben!
💯 1
152 Views