I want to define a piece of metadata on a graph_asset, and have that metadata be accessible via the context in ops #17843
-
I basically want something like this:
I tried using Resources for this, but I actually have multiple graph_assets in my Definition that may each have a different value for "my_key". Whats the best path forward for something like this? |
Beta Was this translation helpful? Give feedback.
Answered by
jamiedemaria
Nov 9, 2023
Replies: 1 comment 1 reply
-
Using metadata you can do something like this @op
def dummy_op_2(context, dummy_op):
value = context.assets_def.metadata_by_key[dummy_asset.key]
context.log.info(value)
@op
def dummy_op(context):
value = context.assets_def.metadata_by_key[dummy_asset.key]
context.log.info(value)
@graph_asset(
metadata={"my_key": "my_value"})
def dummy_asset():
return dummy_op_2(dummy_op()) with config you could do something like this @op(
config_schema={"value": str}
)
def dummy_op_2(context, dummy_op):
value = context.op_config["value"]
context.log.info(value)
@op(
config_schema={"value": str}
)
def dummy_op(context):
value = context.op_config["value"]
context.log.info(value)
@graph_asset(
config={
"dummy_op": {
"config": { "value": "my_value" }
},
"dummy_op_2": {
"config": { "value": "my_value" }
}
},
)
def dummy_asset():
return dummy_op_2(dummy_op()) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jamiedemaria
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using metadata you can do something like this
with config you could do something like this