https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Saul Burgos

08/29/2022, 9:01 PM
I am following this link: https://dagster.slack.com/archives/C01U954MEER/p1643336322430609 I am trying to use the example that you are discussing, but I am getting this message: "InputDefinition" is not defined" I am using dagster 1.0.3. My goal is try to create graph dependencies
Copy code
from 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(),
    )
j

jamie

08/29/2022, 10:13 PM
Hi @Saul Burgos
InputDefinition
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
😄 1
s

Saul Burgos

08/30/2022, 1:16 PM
Thanks
@jamie I have been trying on the new version 1.0.7 but is not working. Can you provide me a simple code like the example above, about how make this works?
j

jamie

09/07/2022, 9:29 PM
@chris do you have a code example of the correct syntax now that the update has gone through?
s

Saul Burgos

09/07/2022, 9:35 PM
This is what I am trying to do and I am getting this error: "_@graph 'graph3' has unmapped input 'x'. Remove it or pass it to the appropriate op/graph invocation._" If I removed the x,y , I got this: "_@graph 'graph3' decorated function does not have parameter(s) 'y, 'x', which are in provided input_defs. @graph decorated functions should only have keyword arguments that match input names and, if system information is required, a first positional parameter named 'context'_."
Copy code
@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
j

jamie

09/09/2022, 3:13 PM
@sandy i remembered chris was on PTO so i played around with this code snippet for a while and couldn't quite get it to work with the nothing dependencies into graph3. do you know what the right syntax is?
🥲 1
s

sandy

09/11/2022, 6:06 PM
hey @Saul Burgos - I would expect your original snippet to work if you take out these lines:
Copy code
input_defs=[
		InputDefinition("x", Nothing),
		InputDefinition("y", Nothing)
	]
if that doesn't work, what error are you hitting?
s

Saul Burgos

09/12/2022, 1:29 PM
@sandy please the new code I am using. in one of my replies , I am not using anymore "InputDefinition" Also I have added the error that I am getting, is the comment number 4
2 Views