Is it possible to create an asset using `from_grap...
# ask-community
Is it possible to create an asset using
and have that asset accept op configs? Or, as an alternative question, what's the right process for providing input variables that are used persistently throughout the graph? My previous use pattern was to define very simple ops that took a config and returned its value and then pass these ops as inputs. What's the correct pattern in asset world? Thanks for your patience with all my questions.
Hi Dmitry. When you define regular ops you can specify a config schema and wrap these ops in a graph. Then, you can pass run config to your job execution. In the asset world, this remains the same, you can do something like:
Copy code
def op_one(context):
    assert context.op_config == 1
    return context.op_config

def op_two(context, op_one):
    assert context.op_config == 2
    return context.op_config + op_one

def my_graph():
    return op_two(op_one())

    run_config={"ops": {"my_graph": {"ops": {"op_one": {"config": 1}, "op_two": {"config": 2}}}}},
@Dmitry Mogilevsky if your goal is to share config across a bunch of ops, our typical recommendation is to use a resource: