Eric Loreaux
03/09/2023, 11:51 PMSpencer Nelson
03/09/2023, 11:54 PMEric Loreaux
03/09/2023, 11:56 PMchris
03/09/2023, 11:56 PMchris
03/09/2023, 11:56 PMEric Loreaux
03/10/2023, 12:03 AM@op(config_schema={"config_param": str})
def op1(context):
...
@op(config_schema={"config_param": str})
def op2(context):
...
With the naive approach, the launchpad configuration for these ops would look like:
ops:
op1:
config:
config_param: X
op2:
config:
config_param: X
But now with the new approach, I use config mapping:
@config_mapping(config_schema={"config_param": str})
def distribute_config(val):
return {
"ops": {
"op1": {
"config": {"config_param": val["config_param"]}
},
"op2": {
"config": {"config_param": val["config_param"]}
},
}
}
But how would this look in launchpad?Eric Loreaux
03/10/2023, 12:04 AMexecute_in_process
chris
03/10/2023, 12:35 AMconfig
argument of the jobchris
03/10/2023, 12:35 AMconfig_param: "blah"
that’s itEric Loreaux
03/10/2023, 12:37 AMconfig_param: "blah"
ops:
...
...
Spencer Nelson
03/10/2023, 6:59 PMconfig_param: "blah"
. You can’t also override the ops, no ops: …
lines at all.chris
03/10/2023, 7:17 PMEric Loreaux
03/12/2023, 8:22 AMEric Loreaux
03/12/2023, 8:23 AMchris
03/13/2023, 12:34 PMouter_config = {"foo": Field(str, default_value="bar")}
for exampleEric Loreaux
04/13/2023, 4:32 AM@asset(config_schema={
"price": float
})
def asset1(context):
return context.op_config["price"] * 2
@asset(config_schema={
"price": float
})
def asset2(context):
return context.op_config["price"] / 2
@config_mapping(config_schema={
"price": Field(
config=float,
default_value=2
)
})
def shared_config(val):
return {
"ops": {
"asset1": {"config": {"price": val["price"]}},
"asset2": {"config": {"price": val["price"]}},
}
}
job1 = define_asset_job(
name="job1",
selection=["asset1", "asset2"],
config=shared_config
)
When I materialize all on dagit, the launchpad is blank and doesn't include the default value of 2 that I configuredchris
04/14/2023, 1:35 AMEric Loreaux
05/02/2023, 5:51 AMconfig_mapping
but without being able to populate it with default values, it makes my pipeline less user-friendlychris
05/02/2023, 5:27 PMchris
05/02/2023, 6:28 PM