I have a graph which sometimes I want to run by it...
# ask-community
j
I have a graph which sometimes I want to run by itself, and sometimes as part of a different graph. It was all working fine by itself. I just decorated the function that defines the graph with
@graph
, created a job via
to_job
and imported the job in my
repo.py
. In order to run it as part of another graph I added
ins
and
out
to the
@graph
decorator. That also runs fine. However since I added the
ins
and
out
to the
@graph
I can’t launch dagit anymore. It’s the job described above that’s causing the problem. it either complains about
Missing required config entry "inputs" at the root
or when I add
inputs
to my yaml it complains that
Error 1: Received unexpected config entry "inputs" at the root.
question: do I have to define 2 separate graphs in this case?
a
are the
inputs
that are mapped on the graph intended to be optional? If yes, you can provide them with a default_value which I believe will resolve the issue. This can be done on the
@op
decorated function like you would normally set default values for function inputs.
j
hm no they’re not optional. they are required by the first op within the graph
but when I run this graph as a subgraph I would like the ability to sometimes run it or not. haven’t looked into how that would work yet though 😄
Oh shoot i think i slightly misread your error message
Error 1: Received unexpected config entry “inputs” at the root.
Is there more to this error? did you fill out the details below
inputs:
or did you just add the key?
j
I filled out the details below
inputs
. yes the error goes on
Copy code
Error 1: Received unexpected config entry "inputs" at the root. Expected: "{ index_and_match: { config: {
and then what follows are all the other ops of the graph with their configs/inputs
a
The structure of the config will be different when the graph is used as subgraph are you trying to provide the inputs information the same way you were when the job was directly using the graph?
j
ah that could be it. yes i am still reading the same yaml file which has
ops
at the root. what’s the structure of the config when the graph takes inputs?
graph
at the root?
a
I forget the exact structure off the top of my head but
dagit
should ideally display it in a way that makes it clear
j
ah but the problem is that dagit doesn’t launch because of this 😄
a
Ah you are setting this on the job directly with
config=
? I would comment that out - get the right thing built in dagit then go back and add it corrected.
@Dagster Bot issue config error language confusing
d
j
ah very nice,
inputs
just have to be defined at the root level (same level as
ops
). thanks!