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

[1/n] Move subscription to web worker #9795

Closed
2 changes: 1 addition & 1 deletion js_modules/dagit/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dev_webapp:
REACT_APP_BACKEND_ORIGIN="http://127.0.0.1:3333" yarn start
REACT_APP_BACKEND_ORIGIN="http://127.0.0.1:3000" yarn start

generate-graphql:
yarn workspace @dagster-io/dagit-core generate-graphql
Expand Down
62 changes: 62 additions & 0 deletions js_modules/dagit/packages/core/src/app/MetadataEntryFragment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import {gql} from '@apollo/client';

import {TABLE_SCHEMA_FRAGMENT} from './TableSchemaFragment';

export const METADATA_ENTRY_FRAGMENT = gql`
fragment MetadataEntryFragment on MetadataEntry {
__typename
label
description
... on PathMetadataEntry {
path
}
... on JsonMetadataEntry {
jsonString
}
... on UrlMetadataEntry {
url
}
... on TextMetadataEntry {
text
}
... on MarkdownMetadataEntry {
mdStr
}
... on PythonArtifactMetadataEntry {
module
name
}
... on FloatMetadataEntry {
floatValue
}
... on IntMetadataEntry {
intValue
intRepr
}
... on BoolMetadataEntry {
boolValue
}
... on PipelineRunMetadataEntry {
runId
}
... on AssetMetadataEntry {
assetKey {
path
}
}
... on TableMetadataEntry {
table {
records
schema {
...TableSchemaFragment
}
}
}
... on TableSchemaMetadataEntry {
schema {
...TableSchemaFragment
}
}
}
${TABLE_SCHEMA_FRAGMENT}
`;
13 changes: 13 additions & 0 deletions js_modules/dagit/packages/core/src/app/PythonErrorFragment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {gql} from '@apollo/client';

export const PYTHON_ERROR_FRAGMENT = gql`
fragment PythonErrorFragment on PythonError {
__typename
message
stack
cause {
message
stack
}
}
`;
Comment on lines +1 to +13
Copy link
Member

Choose a reason for hiding this comment

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

This fragment is already defined in PythonErrorInfo, can you reuse that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I didn't want the initial PR to have a ton of changes so that its easier to review but I'll do what I did in the original PR where I moved the dependencies around and changed all the imports so that theres only 1 definition

12 changes: 0 additions & 12 deletions js_modules/dagit/packages/core/src/app/PythonErrorInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,6 @@ export const UNAUTHORIZED_ERROR_FRAGMENT = gql`
}
`;

export const PYTHON_ERROR_FRAGMENT = gql`
fragment PythonErrorFragment on PythonError {
__typename
message
stack
causes {
message
stack
}
}
`;

const ContextHeader = styled.h4`
font-weight: 400;
margin: 0 0 1em;
Expand Down
20 changes: 20 additions & 0 deletions js_modules/dagit/packages/core/src/app/TableSchemaFragment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {gql} from '@apollo/client';

export const TABLE_SCHEMA_FRAGMENT = gql`
fragment TableSchemaFragment on TableSchema {
__typename
columns {
name
description
type
constraints {
nullable
unique
other
}
}
constraints {
other
}
}
`;
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/app/Telemetry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {print} from 'graphql';
import * as React from 'react';

import {AppContext} from './AppContext';
import {PYTHON_ERROR_FRAGMENT} from './PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from './PythonErrorFragment';

export enum TelemetryAction {
LAUNCH_RUN = 'LAUNCH_RUN',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {gql, useQuery} from '@apollo/client';
import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {NonIdealPipelineQueryResult} from '../pipelines/NonIdealPipelineQueryResult';
import {
SidebarContainerOverview,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {METADATA_ENTRY_FRAGMENT} from '../app/MetadataEntryFragment';
import {ASSET_NODE_CONFIG_FRAGMENT} from '../assets/AssetConfig';
import {AssetDefinedInMultipleReposNotice} from '../assets/AssetDefinedInMultipleReposNotice';
import {AssetEvents} from '../assets/AssetEvents';
Expand All @@ -17,7 +18,6 @@ import {assetDetailsPathForKey} from '../assets/assetDetailsPathForKey';
import {AssetKey} from '../assets/types';
import {DagsterTypeSummary} from '../dagstertype/DagsterType';
import {DagsterTypeFragment} from '../dagstertype/types/DagsterTypeFragment';
import {METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {Description} from '../pipelines/Description';
import {SidebarSection, SidebarTitle} from '../pipelines/SidebarComponents';
import {pluginForMetadata} from '../plugins';
Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/assets/AssetEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {gql, useQuery} from '@apollo/client';
import {Box, ButtonGroup, Colors, NonIdealState, Spinner, Subheading} from '@dagster-io/ui';
import * as React from 'react';

import {METADATA_ENTRY_FRAGMENT} from '../app/MetadataEntryFragment';
import {LiveDataForNode} from '../asset-graph/Utils';
import {METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {SidebarSection} from '../pipelines/SidebarComponents';
import {RepositorySelector} from '../types/globalTypes';

Expand Down
3 changes: 2 additions & 1 deletion js_modules/dagit/packages/core/src/assets/AssetMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import {gql} from '@apollo/client';
import {Box, MetadataTable} from '@dagster-io/ui';
import * as React from 'react';

import {METADATA_ENTRY_FRAGMENT} from '../app/MetadataEntryFragment';
import {DAGSTER_TYPE_FRAGMENT} from '../dagstertype/DagsterType';
import {DagsterTypeFragment} from '../dagstertype/types/DagsterTypeFragment';
import {MetadataEntry, METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {MetadataEntry} from '../metadata/MetadataEntry';
import {MetadataEntryFragment} from '../metadata/types/MetadataEntryFragment';

import {AssetNodeOpMetadataFragment} from './types/AssetNodeOpMetadataFragment';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {gql, RefetchQueriesFunction, useMutation} from '@apollo/client';
import {Button, DialogBody, DialogFooter, Dialog, Group} from '@dagster-io/ui';
import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {displayNameForAssetKey} from '../asset-graph/Utils';

import {AssetWipeMutation, AssetWipeMutationVariables} from './types/AssetWipeMutation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import uniqBy from 'lodash/uniqBy';
import * as React from 'react';
import styled from 'styled-components/macro';

import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {FIFTEEN_SECONDS, useMergedRefresh, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {PythonErrorFragment} from '../app/types/PythonErrorFragment';
import {useLiveDataForAssetKeys} from '../asset-graph/useLiveDataForAssetKeys';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {METADATA_ENTRY_FRAGMENT} from '../app/MetadataEntryFragment';
import {Timestamp} from '../app/time/Timestamp';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {MetadataEntry, METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {MetadataEntry} from '../metadata/MetadataEntry';
import {PipelineReference} from '../pipelines/PipelineReference';
import {linkToRunEvent, titleForRun} from '../runs/RunUtils';
import {isThisThingAJob, useRepository} from '../workspace/WorkspaceContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import React from 'react';
import {useHistory} from 'react-router-dom';

import {showCustomAlert} from '../app/CustomAlertProvider';
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {displayNameForAssetKey} from '../asset-graph/Utils';
import {PartitionHealthSummary, usePartitionHealthData} from '../assets/PartitionHealthSummary';
import {AssetKey} from '../assets/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {Spacing} from '@dagster-io/ui/src/components/types';
import * as React from 'react';
import styled from 'styled-components/macro';

import {METADATA_ENTRY_FRAGMENT} from '../app/MetadataEntryFragment';
import {gqlTypePredicate} from '../app/Util';
import {METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {TableSchema} from '../metadata/TableSchema';
import {MetadataEntryFragment} from '../metadata/types/MetadataEntryFragment';
import {Description} from '../pipelines/Description';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {gql} from '@apollo/client';

export const EXECUTION_PLAN_TO_GRAPH_FRAGMENT = gql`
fragment ExecutionPlanToGraphFragment on ExecutionPlan {
steps {
key
kind
inputs {
dependsOn {
key
kind
}
}
}
}
`;
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/gantt/RunGroupPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {showCustomAlert} from '../app/CustomAlertProvider';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {FIFTEEN_SECONDS, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {SidebarSection} from '../pipelines/SidebarComponents';
import {RunStatusIndicator} from '../runs/RunStatusDots';
Expand Down
17 changes: 0 additions & 17 deletions js_modules/dagit/packages/core/src/gantt/toGraphQueryItems.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {gql} from '@apollo/client';

import {GraphQueryItem} from '../app/GraphQueryImpl';
import {IStepMetadata, IStepState} from '../runs/RunMetadataProvider';
import {StepKind} from '../types/globalTypes';
Expand Down Expand Up @@ -110,18 +108,3 @@ export const toGraphQueryItems = (

return Object.values(nodeTable);
};

export const EXECUTION_PLAN_TO_GRAPH_FRAGMENT = gql`
fragment ExecutionPlanToGraphFragment on ExecutionPlan {
steps {
key
kind
inputs {
dependsOn {
key
kind
}
}
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import styled from 'styled-components/macro';
import {showCustomAlert} from '../app/CustomAlertProvider';
import {SharedToaster} from '../app/DomUtils';
import {usePermissions} from '../app/Permissions';
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {PartitionStatus} from '../partitions/PartitionStatus';
import {PipelineReference} from '../pipelines/PipelineReference';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {gql, useMutation} from '@apollo/client';
import {Button, DialogBody, DialogFooter, Dialog} from '@dagster-io/ui';
import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {cancelableStatuses} from '../runs/RunStatuses';
import {TerminationDialog} from '../runs/TerminationDialog';
import {BulkActionStatus} from '../types/globalTypes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {gql} from '@apollo/client';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';

export const RESUME_BACKFILL_MUTATION = gql`
mutation resumeBackfill($backfillId: String!) {
Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/instance/DaemonList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Group, Table} from '@dagster-io/ui';
import moment from 'moment-timezone';
import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {Timestamp} from '../app/time/Timestamp';

import {DaemonHealth} from './DaemonHealth';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
import * as React from 'react';

import {useFeatureFlags} from '../app/Flags';
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {FIFTEEN_SECONDS, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {useTrackPageView} from '../app/analytics';
import {useDocumentTitle} from '../hooks/useDocumentTitle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {gql, useQuery} from '@apollo/client';
import {Box, Colors, Icon, PageHeader, Spinner, Heading, TextInput} from '@dagster-io/ui';
import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {FIFTEEN_SECONDS, useMergedRefresh, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {useTrackPageView} from '../app/analytics';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {gql, useQuery} from '@apollo/client';
import {Box, Colors, Group, NonIdealState, PageHeader, Heading, Subheading} from '@dagster-io/ui';
import * as React from 'react';

import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {FIFTEEN_SECONDS, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {useTrackPageView} from '../app/analytics';
import {INSTIGATION_STATE_FRAGMENT} from '../instigation/InstigationUtils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {gql, useQuery} from '@apollo/client';
import {Box, Colors, NonIdealState, PageHeader, Heading, Subheading} from '@dagster-io/ui';
import * as React from 'react';

import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {useQueryRefreshAtInterval, FIFTEEN_SECONDS} from '../app/QueryRefresh';
import {useTrackPageView} from '../app/analytics';
import {INSTIGATION_STATE_FRAGMENT} from '../instigation/InstigationUtils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import * as React from 'react';
import styled from 'styled-components/macro';

import {showCustomAlert} from '../app/CustomAlertProvider';
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {assertUnreachable} from '../app/Util';
import {RunTable, RUN_TABLE_RUN_FRAGMENT} from '../runs/RunTable';
import {InstigationTickStatus, InstigationType} from '../types/globalTypes';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {LastRunSummary} from '../instance/LastRunSummary';
import {RunStatusIndicator} from '../runs/RunStatusDots';
import {RUN_TIME_FRAGMENT, titleForRun} from '../runs/RunUtils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {Button, DialogBody, DialogFooter, Dialog, Group, Icon} from '@dagster-io
import * as React from 'react';

import {copyValue} from '../app/DomUtils';
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {TimestampDisplay} from '../schedules/TimestampDisplay';
import {InstigationSelector, InstigationTickStatus} from '../types/globalTypes';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import * as React from 'react';
import styled from 'styled-components/macro';

import {SharedToaster} from '../app/DomUtils';
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {ONE_MONTH, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {useCopyToClipboard} from '../app/browser';
import {useQueryPersistedState} from '../hooks/useQueryPersistedState';
Expand Down