https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Samuel Stütz

09/07/2022, 8:13 AM
Is it possible to add configs to assets which are partitioned. I got
dagster._check.CheckError: Invariant failed. Description: Can't supply a ConfigMappi/ng for 'config' when 'partitions_def' is supplied.
However I have an @asset which has some configs so the underlying op can be easily reused as a template. But it seems I cannot combine configs with partitions anymore or never tried. Do I have to either partition or configure the asset? I got op + config = asset which works now I would like op + config + partition = partitioned asset ???
🤖 1
j

Jon Simpson

09/07/2022, 3:46 PM
Haven’t done it, But there is a Partitioned Config object, likely a starting place to look into where that gets used. As you provide both a config and partition_def
y

yuhan

09/07/2022, 5:59 PM
Yup
PartitionedConfig
helps in this case. You can do:
Copy code
@op(config_schema={"date": str})
def my_op(_):
    pass

@graph
def my_graph():
    my_op()

def config_fn(partition: Partition):
    return {"ops": {"my_op": {"config": {"date": partition.value}}}}

job = my_graph.to_job(
    config=PartitionedConfig(
        run_config_for_partition_fn=config_fn,
        partitions_def=StaticPartitionsDefinition(["2020-02-25", "2020-02-26"]),
    ),
)
d

Dimitris Stafylarakis

09/28/2022, 7:22 AM
Is this only for StaticsPartitionsDefinition? because I’m trying it with DailyPartitionsDefinition without success (perhaps relevant error message:
grpc_message:"Exception calling application: Can only serialize whitelisted namedtuples, received TimeWindow
)
turns out it was an unrelated bug
4 Views