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

Batch fetching latest asset check executions #17650

Merged

Conversation

johannkm
Copy link
Contributor

@johannkm johannkm commented Nov 2, 2023

Add a batch loader for the executionForLatestMaterialization resolver, which we call to display the asset graph. Uses the event log method get_latest_asset_check_execution_by_key instead of fetching each execution separately.

There's still optimization to be done, e.g. we're still fetching the asset record once per check. I'll follow up with that in a separate diff.

@@ -138,3 +149,113 @@ def get_checks_for_asset(
)

return self._checks[asset_key]


def _execution_targets_latest_materialization(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved over from fetch_asset_checks.py

@johannkm johannkm requested review from rexledesma and sryza November 2, 2023 20:03
@johannkm johannkm force-pushed the johann/11-02-Batch_fetching_latest_asset_check_executions branch from 1f36e09 to be4d6f7 Compare November 2, 2023 20:22
@johannkm johannkm force-pushed the johann/11-02-remove_top_level_assetChecksOrError_resolver branch from 869b085 to efa6d08 Compare November 2, 2023 20:53
@johannkm johannkm force-pushed the johann/11-02-Batch_fetching_latest_asset_check_executions branch from be4d6f7 to aeaa9cf Compare November 2, 2023 20:53
Base automatically changed from johann/11-02-remove_top_level_assetChecksOrError_resolver to master November 2, 2023 20:58
@johannkm johannkm force-pushed the johann/11-02-Batch_fetching_latest_asset_check_executions branch from aeaa9cf to cdccbb8 Compare November 2, 2023 20:59
):
self._asset_check = asset_check
self._can_execute_individually = can_execute_individually
self._exeuction_loader = execution_loader
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Suggested change
self._exeuction_loader = execution_loader
self._execution_loader = execution_loader

asset_graph = ExternalAssetGraph.from_workspace(self._context)
if limit_per_asset:
for asset_key, external_checks_for_asset in external_checks.items():
external_checks[asset_key] = external_checks_for_asset[:limit_per_asset]
Copy link
Contributor

Choose a reason for hiding this comment

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

external_checks should be renamed external_checks_by_asset_key. It is currently confusing to parse since we iterate on it multiple times.

Suggested change
external_checks[asset_key] = external_checks_for_asset[:limit_per_asset]
external_checks_by_asset_key[asset_key] = external_checks_for_asset[:limit_per_asset]

@johannkm johannkm force-pushed the johann/11-02-Batch_fetching_latest_asset_check_executions branch from cdccbb8 to 0c8c36b Compare November 2, 2023 22:30
@johannkm johannkm merged commit d7b069b into master Nov 2, 2023
1 check passed
@johannkm johannkm deleted the johann/11-02-Batch_fetching_latest_asset_check_executions branch November 2, 2023 22:31
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.

2 participants