https://dagster.io/ logo
Title
i

Ivan Tsarev

04/13/2023, 12:26 AM
Hi everyone! What is correct way to pass
Nothing
-typed arg into graph?
GraphIn
class has no
dagster_type
arg and something like
@graph(input_defs=[InputDefinition("foo", dagster_type=Nothing)])
def bar():
  pass
produces error:
@graph 'bar' decorated function does not have argument(s) 'foo'. @graph-decorated functions should have a keyword argument for each of their Ins, except for Ins that have the Nothing dagster_type. Alternatively, they can accept **kwargs.
Update: maybe I`m doing something wrong from the very beginning. So my case is that I have two independent graphs - one moving some data from A to B and another moving from B to C. They both don't have any inputs or outputs now. And I want to create single A-to-B-to-C graph to have single job for this extraction instead of two. So I'm looking for options to queue one after another basically while they share "configurations" like exact location at B via resources.
c

claire

04/13/2023, 8:27 PM
Hi Ivan. I think what you're doing sounds reasonable, this is just an intricacy with dagster graphs. Under the hood, dagster flattens graphs into a flat mapping of ops--this means that any input to a graph must be passed as an input to at least one op within the graph. So something like this below would work:
@op
def my_op():
    return 5


@op(ins={"my_input": In(Nothing)})
def downstream():
    return 1


@graph
def my_graph(my_input):
    downstream(my_input)