Skip to content

Commit

Permalink
remove top level assetChecksOrError resolver (#17647)
Browse files Browse the repository at this point in the history
This is replaced by AssetNode.assetChecksOrError
  • Loading branch information
johannkm authored Nov 2, 2023
1 parent 14433d1 commit ef98a86
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 320 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
from dagster._core.storage.dagster_run import DagsterRunStatus

from ..schema.asset_checks import (
AssetChecksOrErrorUnion,
GrapheneAssetCheckExecution,
GrapheneAssetChecks,
)
from .asset_checks_loader import AssetChecksLoader, asset_checks_iter
from .asset_checks_loader import asset_checks_iter

if TYPE_CHECKING:
from ..schema.util import ResolveInfo
Expand All @@ -34,23 +32,6 @@ def has_asset_checks(
)


def fetch_asset_checks(
graphene_info: "ResolveInfo",
asset_key: AssetKey,
check_name: Optional[str] = None,
) -> AssetChecksOrErrorUnion:
# use the batched loader with a single asset
loader = AssetChecksLoader(context=graphene_info.context, asset_keys=[asset_key])
all_checks = loader.get_checks_for_asset(asset_key)
if not check_name or not isinstance(all_checks, GrapheneAssetChecks):
return all_checks
# the only case where we filter by check name is for execution history. We'll make that it's own resolver.
# For now, just filter the checks in the response.
return GrapheneAssetChecks(
checks=[check for check in all_checks.checks if check._asset_check.name == check_name] # noqa: SLF001
)


def _get_asset_check_execution_status(
instance: DagsterInstance, execution: AssetCheckExecutionRecord
) -> AssetCheckExecutionResolvedStatus:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
fetch_repository,
fetch_workspace,
)
from ...implementation.fetch_asset_checks import fetch_asset_check_executions, fetch_asset_checks
from ...implementation.fetch_asset_checks import fetch_asset_check_executions
from ...implementation.fetch_assets import (
get_asset,
get_asset_node,
Expand Down Expand Up @@ -92,7 +92,7 @@
graph_selector_from_graphql,
pipeline_selector_from_graphql,
)
from ..asset_checks import GrapheneAssetCheckExecution, GrapheneAssetChecksOrError
from ..asset_checks import GrapheneAssetCheckExecution
from ..asset_graph import (
GrapheneAssetLatestInfo,
GrapheneAssetNode,
Expand Down Expand Up @@ -525,14 +525,6 @@ class Meta:
description="Fetch the history of auto-materialization ticks",
)

# deprecated. Use assetNode { assetChecksOrError } or assetCheckExecutions instead
assetChecksOrError = graphene.Field(
graphene.NonNull(GrapheneAssetChecksOrError),
assetKey=graphene.Argument(graphene.NonNull(GrapheneAssetKeyInput)),
checkName=graphene.Argument(graphene.String()),
description="Retrieve the asset checks for a given asset key.",
)

assetCheckExecutions = graphene.Field(
non_null_list(GrapheneAssetCheckExecution),
assetKey=graphene.Argument(graphene.NonNull(GrapheneAssetKeyInput)),
Expand Down Expand Up @@ -1131,14 +1123,6 @@ def resolve_autoMaterializeTicks(
after=afterTimestamp,
)

def resolve_assetChecksOrError(
self,
graphene_info: ResolveInfo,
assetKey: GrapheneAssetKeyInput,
checkName: Optional[str] = None,
):
return fetch_asset_checks(graphene_info, AssetKey.from_graphql_input(assetKey), checkName)

def resolve_assetCheckExecutions(
self,
graphene_info: ResolveInfo,
Expand Down
Loading

1 comment on commit ef98a86

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-lyd7jut7y-elementl.vercel.app

Built with commit ef98a86.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.