Hi folks If I have a static partitioned job which...
# ask-community
m
Hi folks If I have a static partitioned job which uses
context.partition_key
to access the partition key when running a single partition, how can I access the partition keys associated with a single run back fill? When I try access
asset_partition_keys
instead of
asset_partition_key
I get the following error:
Copy code
AttributeError: 'OpExecutionContext' object has no attribute 'asset_partition_keys'. Did you mean: 'has_partition_key'?
By “single run backfill” I mean manually selecting more than one partition and selecting “single run”
t
Hi! It's a slightly different set of methods if you're doing single runs. In your case, you might want to use
partition_key_range
. We're in the ealry days of potentially consolidating these so you don't have to use different APIs across single runa nd multi-run backfills
m
Hi Tim! Sorry I failed to mention that I tried that and got a range object back which has a start and end. However my use case has nominal partitions ( names of machine learning models for example) so that doesn’t make sense in my use case and only works if selecting 2 partitions
t
Ah, yeah, same sharp edge with Dagster and separate APIs.
asset_partition_keys_for_output
/
asset_partition_keys_for_input
should be used for single-run, discrete partitioned runs. Sorry once again that you have to deal with this!
m
Ah ok thanks, I’ll look at that so. Thanks for the support! Especially during the weekend!
@Tim Castillo this works well, thank you!