How can I pass inputs to an op in a graph asset? F...
# ask-ai
z
How can I pass inputs to an op in a graph asset? For example, I have a graph asset like this:
Copy code
@op
def op1(some_input: str)
  return 1
@graph_asset():
  op1()
How do I construct run config that would pass a value to
some_input
as an unconnected input?
s
To pass inputs to an op within a graph asset, you would typically define the inputs at the graph level and then pass them through to the ops within the graph. However, in the case of a graph asset, you don't define the inputs in the same way as you would with a regular graph or job. Instead, you need to provide the inputs through the run config when you execute the asset. Here's an example of how you might define a graph asset and provide a value to an unconnected input through the run config:
Copy code
python from dagster import op, graph_asset  @op def op1(some_input: str):     return some_input  @graph_asset def my_graph_asset():     op1()
To execute this graph asset and pass a value to
some_input
, you would construct a run config that specifies the value for that input. The run config would look something like this:
Copy code
yaml ops:   op1:     inputs:       some_input: "value_to_pass"
When you execute the graph asset, you would provide this run config to specify the value for
some_input
. In Dagit, you can provide this config by using the config editor when you materialize the asset, or you can provide it programmatically if you are using the Python API to execute the asset. Please note that the exact structure of the run config might vary depending on the version of Dagster you are using and the specific setup of your assets and ops. Always refer to the latest Dagster documentation for the most accurate and up-to-date information on constructing run configs for graph assets.
z
@Ion Koutsouris I'm not sure I quite understand. Any chance you could provide an example?