Skip to content

Commit

Permalink
use top level resources field in LaunchAssetLoaderResourceQuery (#25895)
Browse files Browse the repository at this point in the history
Summary:
Lets us fetch the resources for the job without neccesarily needing to
fetch the full job snapshot.

Test Plan: Launch an asset job in the UI

## Summary & Motivation

## How I Tested These Changes

## Changelog

> Insert changelog entry or delete this section.
  • Loading branch information
gibsondan authored Nov 13, 2024
1 parent 4b16b0e commit 19f5b2a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 770 deletions.
2 changes: 1 addition & 1 deletion js_modules/dagster-ui/packages/ui-core/client.json

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 @@ -54,7 +54,6 @@ import {PipelineSelector} from '../graphql/types';
import {AssetLaunchpad} from '../launchpad/LaunchpadRoot';
import {LaunchPipelineExecutionMutationVariables} from '../runs/types/RunUtils.types';
import {testId} from '../testing/testId';
import {CONFIG_TYPE_SCHEMA_FRAGMENT} from '../typeexplorer/ConfigTypeSchema';
import {buildRepoAddress} from '../workspace/buildRepoAddress';
import {repoAddressAsHumanString} from '../workspace/repoAddressAsString';
import {RepoAddress} from '../workspace/types';
Expand Down Expand Up @@ -878,8 +877,8 @@ export const LAUNCH_ASSET_LOADER_RESOURCE_QUERY = gql`
$repositoryLocationName: String!
$repositoryName: String!
) {
pipelineOrError(
params: {
resourcesOrError(
pipelineSelector: {
pipelineName: $pipelineName
repositoryName: $repositoryName
repositoryLocationName: $repositoryLocationName
Expand All @@ -894,30 +893,16 @@ export const LAUNCH_ASSET_LOADER_RESOURCE_QUERY = gql`
... on PipelineNotFoundError {
message
}
... on Pipeline {
id
modes {
id
resources {
name
description
configField {
name
isRequired
configType {
...ConfigTypeSchemaFragment
recursiveConfigTypes {
...ConfigTypeSchemaFragment
}
}
}
... on ResourceConnection {
resources {
name
configField {
isRequired
}
}
}
}
}
${CONFIG_TYPE_SCHEMA_FRAGMENT}
`;

export const LAUNCH_ASSET_CHECK_UPSTREAM_QUERY = gql`
Expand Down Expand Up @@ -959,15 +944,14 @@ async function checkIfResourcesRequireConfig({
repositoryLocationName: repoAddress.location,
},
});
const pipeline = resourceResult.data.pipelineOrError;
if (pipeline.__typename !== 'Pipeline') {
const resourceConnection = resourceResult.data.resourcesOrError;
if (resourceConnection.__typename !== 'ResourceConnection') {
return {
error: pipeline.message,
error: resourceConnection.message,
requiredConfigPresent: false,
};
}

const resources = pipeline.modes[0]!.resources.filter((r) =>
const resources = resourceConnection.resources.filter((r) =>
requiredResourceKeys.includes(r.name),
);
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
buildDimensionPartitionKeys,
buildInstance,
buildMaterializationEvent,
buildMode,
buildPartitionDefinition,
buildPartitionRunConfig,
buildPartitionTags,
Expand Down Expand Up @@ -444,16 +443,7 @@ export const buildLaunchAssetLoaderGenericJobMock = (jobName: string) => {
result: {
data: {
__typename: 'Query',
pipelineOrError: {
id: '8e2d3f9597c4a45bb52fe9ab5656419f4329d4fb',
modes: [
buildMode({
id: 'da3055161c528f4c839339deb4a362ec1be4f079-default',
resources: [],
}),
],
__typename: 'Pipeline',
},
resourcesOrError: {__typename: 'ResourceConnection', resources: []},
},
},
};
Expand All @@ -472,84 +462,18 @@ export const LaunchAssetLoaderResourceJob7Mock: MockedResponse<LaunchAssetLoader
result: {
data: {
__typename: 'Query',
pipelineOrError: {
id: '8e2d3f9597c4a45bb52fe9ab5656419f4329d4fb',
modes: [
resourcesOrError: {
__typename: 'ResourceConnection',
resources: [
{
id: 'da3055161c528f4c839339deb4a362ec1be4f079-default',
resources: [
{
name: 'io_manager',
description:
'Built-in filesystem IO manager that stores and retrieves values using pickling.',
configField: {
name: 'config',
isRequired: false,
configType: {
__typename: 'CompositeConfigType',
key: 'Shape.18b2faaf1efd505374f7f25fcb61ed59bd5be851',
description: null,
isSelector: false,
typeParamKeys: [],
fields: [
{
name: 'base_dir',
description: null,
isRequired: false,
configTypeKey: 'StringSourceType',
defaultValueAsJson: null,
__typename: 'ConfigTypeField',
},
],
recursiveConfigTypes: [
{
__typename: 'CompositeConfigType',
key: 'Selector.2571019f1a5201853d11032145ac3e534067f214',
description: null,
isSelector: true,
typeParamKeys: [],
fields: [
{
name: 'env',
description: null,
isRequired: true,
configTypeKey: 'String',
defaultValueAsJson: null,
__typename: 'ConfigTypeField',
},
],
},
{
__typename: 'RegularConfigType',
givenName: 'String',
key: 'String',
description: '',
isSelector: false,
typeParamKeys: [],
},
{
__typename: 'ScalarUnionConfigType',
key: 'StringSourceType',
description: null,
isSelector: false,
typeParamKeys: [
'String',
'Selector.2571019f1a5201853d11032145ac3e534067f214',
],
scalarTypeKey: 'String',
nonScalarTypeKey: 'Selector.2571019f1a5201853d11032145ac3e534067f214',
},
],
},
__typename: 'ConfigTypeField',
},
__typename: 'Resource',
},
],
__typename: 'Mode',
name: 'io_manager',
configField: {
isRequired: false,
__typename: 'ConfigTypeField',
},
__typename: 'Resource',
},
],
__typename: 'Pipeline',
},
},
},
Expand All @@ -567,84 +491,18 @@ export const LaunchAssetLoaderResourceJob8Mock: MockedResponse<LaunchAssetLoader
result: {
data: {
__typename: 'Query',
pipelineOrError: {
id: '8689a9dcd052f769b73d73dfe57e89065dac369d',
modes: [
resourcesOrError: {
__typename: 'ResourceConnection',
resources: [
{
id: '719d9b2c592b98ae0f4a7ec570cae0a06667db31-default',
resources: [
{
name: 'io_manager',
description:
'Built-in filesystem IO manager that stores and retrieves values using pickling.',
configField: {
name: 'config',
isRequired: false,
configType: {
__typename: 'CompositeConfigType',
key: 'Shape.18b2faaf1efd505374f7f25fcb61ed59bd5be851',
description: null,
isSelector: false,
typeParamKeys: [],
fields: [
{
name: 'base_dir',
description: null,
isRequired: false,
configTypeKey: 'StringSourceType',
defaultValueAsJson: null,
__typename: 'ConfigTypeField',
},
],
recursiveConfigTypes: [
{
__typename: 'CompositeConfigType',
key: 'Selector.2571019f1a5201853d11032145ac3e534067f214',
description: null,
isSelector: true,
typeParamKeys: [],
fields: [
{
name: 'env',
description: null,
isRequired: true,
configTypeKey: 'String',
defaultValueAsJson: null,
__typename: 'ConfigTypeField',
},
],
},
{
__typename: 'RegularConfigType',
givenName: 'String',
key: 'String',
description: '',
isSelector: false,
typeParamKeys: [],
},
{
__typename: 'ScalarUnionConfigType',
key: 'StringSourceType',
description: null,
isSelector: false,
typeParamKeys: [
'String',
'Selector.2571019f1a5201853d11032145ac3e534067f214',
],
scalarTypeKey: 'String',
nonScalarTypeKey: 'Selector.2571019f1a5201853d11032145ac3e534067f214',
},
],
},
__typename: 'ConfigTypeField',
},
__typename: 'Resource',
},
],
__typename: 'Mode',
name: 'io_manager',
configField: {
isRequired: false,
__typename: 'ConfigTypeField',
},
__typename: 'Resource',
},
],
__typename: 'Pipeline',
},
},
},
Expand All @@ -663,16 +521,7 @@ export const LaunchAssetLoaderResourceMyAssetJobMock: MockedResponse<LaunchAsset
result: {
data: {
__typename: 'Query',
pipelineOrError: {
id: '8689a9dcd052f769b73d73dfe57e89065dac369d',
modes: [
buildMode({
id: '719d9b2c592b98ae0f4a7ec570cae0a06667db31-default',
resources: [],
}),
],
__typename: 'Pipeline',
},
resourcesOrError: {__typename: 'ResourceConnection', resources: []},
},
},
};
Expand Down
Loading

1 comment on commit 19f5b2a

@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-1zykskiju-elementl.vercel.app

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

Please sign in to comment.