Shane Keller
03/05/2024, 11:43 PMScout
03/05/2024, 11:43 PMpython from dagster import op, graph, In, Out @op def upstream_op(): # This op would perform some computation and return a result return "result_from_upstream" @op def process_data(data: str): # This op takes the result from the upstream op and does further processing return f"processed_{data}" @graph def my_graph(input_data: str): processed_data = process_data(input_data) return processed_data # Now, to use the output of `upstream_op` as the input to `my_graph`, you would # execute the graph and pass the output of `upstream_op` to it. result = my_graph(upstream_op())
In this example, upstream_op
is an op that generates some data. The my_graph
graph takes an input, which is expected to be the output from upstream_op
. Inside my_graph
, the process_data
op is called with the input data, which processes it further. Please note that this example is for illustrative purposes to show how the output of an upstream op can be used as an input to a graph. In a real-world scenario, you would likely have more complex logic within your ops and graphs, and you would execute the graph within a job or a test environment.