Oren Lederman
05/22/2023, 9:34 PMclaire
05/22/2023, 9:41 PMOren Lederman
05/22/2023, 9:43 PMclaire
05/22/2023, 9:48 PM@op
def my_op():
return 1
@job(
partitions_def=MultiPartitionsDefinition(
{
"abc": StaticPartitionsDefinition(["a", "b", "c"]),
"time": DailyPartitionsDefinition("2023-01-01"),
}
)
)
def my_job():
my_op()
Oren Lederman
05/22/2023, 9:54 PMOren Lederman
05/22/2023, 10:43 PMmulti_part_def = MultiPartitionsDefinition(
{
"abc": StaticPartitionsDefinition(["a", "b", "c"]),
"time": DailyPartitionsDefinition("2023-01-01"),
}
)
multi_part_config = PartitionedConfig(
partitions_def=multi_part_def,
run_config_for_partition_fn=lambda partition: {
"ops": {
"process_data_for_date": {
"config": {
"time": partition.value.keys_by_dimension["time"],
"abc": partition.value.keys_by_dimension["abc"],
}
}
}
},
)
@job(config=multi_part_config)
def do_stuff_partitioned():
process_data_for_date()
claire
05/22/2023, 10:43 PM@op
def my_op(context):
context.partition_key.keys_by_dimension
...
Oren Lederman
05/22/2023, 10:50 PMops
need to be aware that the job is defined as a partitioned job, which I prefer to avoid at the moment. I found how to create a PartitionedConfig though, and that should be good enough for what I currently need.