Skip to content

Commit

Permalink
asset checks stepKey gql (#17055)
Browse files Browse the repository at this point in the history
Surface the asset check step key, so we can link to the step in runs
  • Loading branch information
johannkm authored Oct 9, 2023
1 parent 90de2db commit 4b1ae14
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.

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

2 changes: 2 additions & 0 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 @@ -90,6 +90,7 @@ class GrapheneAssetCheckExecution(graphene.ObjectType):
timestamp = graphene.Field(
graphene.NonNull(graphene.Float), description="When the check run started"
)
stepKey = graphene.Field(graphene.String)

class Meta:
name = "AssetCheckExecution"
Expand All @@ -110,6 +111,7 @@ def __init__(
else None
)
self.timestamp = execution.create_timestamp
self.stepKey = execution.event.step_key if execution.event else None


class GrapheneAssetCheckCanExecuteIndividually(graphene.Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@
}
"""

GET_ASSET_CHECK_HISTORY_WITH_STEP_KEY = """
query GetAssetChecksQuery($assetKey: AssetKeyInput!, $checkName: String) {
assetChecksOrError(assetKey: $assetKey, checkName: $checkName) {
... on AssetChecks {
checks {
name
executions(limit: 10) {
runId
status
stepKey
}
}
}
}
}
"""

GET_LOGS_FOR_RUN = """
query GetLogsForRun($runId: ID!) {
logsForRun(runId: $runId) {
Expand Down Expand Up @@ -1144,3 +1161,56 @@ def test_multi_asset_only_check(self, graphql_context: WorkspaceRequestContext):
and log.dagster_event.event_type == DagsterEventType.ASSET_MATERIALIZATION
]
assert len(materializations) == 0

def test_step_key(self, graphql_context: WorkspaceRequestContext):
selector = infer_job_or_pipeline_selector(
graphql_context,
"checked_multi_asset_job",
asset_selection=[],
asset_check_selection=[
{"assetKey": {"path": ["one"]}, "name": "my_check"},
],
)
result = execute_dagster_graphql(
graphql_context,
LAUNCH_PIPELINE_EXECUTION_MUTATION,
variables={
"executionParams": {
"selector": selector,
"mode": "default",
"stepKeys": None,
}
},
)
print(result.data) # noqa: T201
assert result.data["launchPipelineExecution"]["__typename"] == "LaunchRunSuccess"

run_id = result.data["launchPipelineExecution"]["run"]["runId"]
run = poll_for_finished_run(graphql_context.instance, run_id, timeout=10000000000)

logs = graphql_context.instance.all_logs(run_id)
print(logs) # noqa: T201
assert run.is_success

result = execute_dagster_graphql(
graphql_context,
GET_ASSET_CHECK_HISTORY_WITH_STEP_KEY,
variables={"assetKey": {"path": ["one"]}, "checkName": "my_check", "limit": 10},
)
print(result.data) # noqa: T201
assert result.data == {
"assetChecksOrError": {
"checks": [
{
"name": "my_check",
"executions": [
{
"runId": run_id,
"status": "SUCCEEDED",
"stepKey": "subsettable_checked_multi_asset",
}
],
}
],
}
}

1 comment on commit 4b1ae14

@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-5c4lzp93b-elementl.vercel.app

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

Please sign in to comment.