bx2
08/07/2023, 3:27 PMdagster._core.errors.DagsterInvariantViolationError: Cannot access partition_key for a non-partitioned run
am i doing something wrong or should i report a github ticket?claire
08/08/2023, 8:56 PMpartitions_def = DynamicPartitionsDefinition(name='fruits')
@observable_source_asset(partitions_def=partitions_def)
def source_asset():
return DataVersionsByPartition({"apple": DataVersion("one"), "orange": DataVersion("two")})
and clicking "observe" executes the run without an error.
Would you mind sharing your code for your observable source asset? And also the version you're running dagster on?bx2
08/09/2023, 5:07 PMcontext.partition_key
), I face the following issues:
• I get the error "cannot access partition_key for a non-partitioned run."
• context.has_partition_key
returns False
when I use the UI and click "Observe" on the asset.
Any guidance on this would be appreciated!claire
08/10/2023, 5:50 PM@observable_source_asset(partitions_def=partitions_def)
def source_asset(context):
partitions_def.get_partition_keys(dynamic_partitions_store=context.instance)
...
Unfortunately it's currently not possible to execute an observable source asset for a given partition via the UI, which is why you're seeing an error when calling context.partition_key
. You'll have to return a data version for each partition in the interimbx2
08/10/2023, 6:06 PMbx2
08/11/2023, 9:41 AM@observable_source_asset(partitions_def=site_partitions)
def posts(
context: AssetExecutionContext,
ceres_content_client: CeresContentClient,
):
sites = site_partitions.get_partition_keys(
dynamic_partitions_store=context.instance,
)
versions = {site: DataVersion("1") for site in sites}
return DataVersionsByPartition(versions)
@asset(partitions_def=site_partitions, deps=[posts])
def sitemap(context: AssetExecutionContext):
return {"test": "aaa"}
What I see when this is defined (screenshot) - always missing partitions for the source asset and I cannot materialize it anyway. Running "observe" will get the data version changes and observation events, i.e. I see them then in per-partition events, but the source just keeps loading for some reason and the downstream does not react to any of the version changes. I am sure that I misunderstand something or am doing something wrong, I just don't know what 😄 Thanks upfront for your time!bx2
08/11/2023, 9:42 AMclaire
08/18/2023, 5:18 PMbx2
08/18/2023, 5:23 PMclaire
08/18/2023, 5:34 PMsitemap
asset, i.e. AutoMaterializePolicy.eager()
, the auto-materialize policy will kick off execution for sitemap
whenever the data version of the observable source asset changes. By default, this is limited to 1 partition per evaluation for rate limiting purposes, but you can increase that number