Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DA][perf] Avoid recomputing in progress subset #22734

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

OwenKephart
Copy link
Contributor

Summary & Motivation

We have a simple an efficient way of avoiding doing work when the "materialize" subset is fully up-to-date in the partition status cache. Because we don't have an ASSET_MATERIALIZATION_FAILED event, the same cannot be said regarding the in-progress subset.

So if you have any in-progress runs targeting an asset get_and_update_asset_status_cache_value will always be expensive, even if you only care about the "materialized_susbet" value, which is cheap to calculate. This adds a bit of code to avoid updating the entire asset status cache in cases where the materialized_subset is known to be up to date.

How I Tested These Changes

Comment on lines 165 to 170
asset_record
and stored_cache_value
and (stored_cache_value.latest_storage_id or 0)
>= (asset_record.asset_entry.last_materialization_storage_id or 0)
and stored_cache_value.partitions_def_id
== partitions_def.get_serializable_unique_identifier(dynamic_partitions_store=self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is clever but pretty gnarly, maybe should be a separate helper function in the partition_status_cache module?

def is_cached_materialized_subset_up_to_date(asset_record: AssetRecord, parittions_def: PartitionsDefinition, dynamic_partitions_store) {

}

Copy link
Member

@gibsondan gibsondan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small restructuring suggestion, very sneaky

@OwenKephart OwenKephart force-pushed the owen/avoid-recomputing-in-progress-subset branch from 15e62ec to 6095a69 Compare July 1, 2024 16:36
@OwenKephart OwenKephart requested review from gibsondan and removed request for gibsondan July 1, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants