-
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
This is a question that has come up in a few different places, so wanted to document the pattern we use currently:
|
Beta Was this translation helpful? Give feedback.
-
You can also use the built-in util method See example here: https://docs.dagster.io/concepts/configuration/config-schema#passing-configuration-to-multiple-ops-in-a-job |
Beta Was this translation helpful? Give feedback.
-
You can also do this with the
|
Beta Was this translation helpful? Give feedback.
-
@yuhan - it seems like this might be a better answer moving forward (1.5.8+): from dagster import ConfigurableResource, op, graph, RunConfig, OpExecutionContext
class MyConfig(ConfigurableResource):
val: str = "default"
@op()
def foo(context: OpExecutionContext, config_resource: MyConfig):
context.log.info(config_resource.val)
@op()
def bar(context: OpExecutionContext, config_resource: MyConfig):
context.log.info(config_resource.val)
@graph
def my_graph():
foo()
bar()
my_job = my_graph.to_job(
resource_defs={"config_resource": MyConfig(val="blah")},
) |
Beta Was this translation helpful? Give feedback.
-
https://docs.dagster.io/concepts/ops-jobs-graphs/op-jobs#config-mapping
|
Beta Was this translation helpful? Give feedback.
@yuhan - it seems like this might be a better answer moving forward (1.5.8+):