Skip to content

Commit

Permalink
Merge branch 'master' into nikki/docs/add-tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
neverett committed Jan 3, 2025
2 parents ee85b02 + 4044cd6 commit 8c7f92b
Show file tree
Hide file tree
Showing 78 changed files with 1,677 additions and 206 deletions.
Binary file modified docs/content/api/modules.json.gz
Binary file not shown.
Binary file modified docs/content/api/searchindex.json.gz
Binary file not shown.
Binary file modified docs/content/api/sections.json.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions docs/content/integrations/sigma.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ from dagster_sigma import (
DagsterSigmaTranslator,
SigmaBaseUrl,
SigmaOrganization,
SigmaWorkbook,
SigmaWorkbookTranslatorData,
load_sigma_asset_specs,
)

Expand All @@ -117,15 +117,15 @@ sigma_organization = SigmaOrganization(

# A translator class lets us customize properties of the built Sigma assets, such as the owners or asset key
class MyCustomSigmaTranslator(DagsterSigmaTranslator):
def get_asset_spec(self, data: SigmaWorkbook) -> dg.AssetSpec:
def get_asset_spec(self, data: SigmaWorkbookTranslatorData) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(data)
# we customize the team owner tag for all Sigma assets
return default_spec.replace_attributes(owners=["team:my_team"])


sigma_specs = load_sigma_asset_specs(
sigma_organization, dagster_sigma_translator=MyCustomSigmaTranslator
sigma_organization, dagster_sigma_translator=MyCustomSigmaTranslator()
)
defs = dg.Definitions(assets=[*sigma_specs], resources={"sigma": sigma_organization})
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DagsterSigmaTranslator,
SigmaBaseUrl,
SigmaOrganization,
SigmaWorkbook,
SigmaWorkbookTranslatorData,
load_sigma_asset_specs,
)

Expand All @@ -17,14 +17,14 @@

# A translator class lets us customize properties of the built Sigma assets, such as the owners or asset key
class MyCustomSigmaTranslator(DagsterSigmaTranslator):
def get_asset_spec(self, data: SigmaWorkbook) -> dg.AssetSpec:
def get_asset_spec(self, data: SigmaWorkbookTranslatorData) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(data) # type: ignore
default_spec = super().get_asset_spec(data)
# we customize the team owner tag for all Sigma assets
return default_spec.replace_attributes(owners=["team:my_team"])


sigma_specs = load_sigma_asset_specs(
sigma_organization, dagster_sigma_translator=MyCustomSigmaTranslator
sigma_organization, dagster_sigma_translator=MyCustomSigmaTranslator()
)
defs = dg.Definitions(assets=[*sigma_specs], resources={"sigma": sigma_organization})
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Button} from './Button';
import {Icon} from './Icon';

export interface CursorPaginationProps {
cursor?: string;
hasPrevCursor: boolean;
hasNextCursor: boolean;
popCursor: () => void;
Expand Down
6 changes: 4 additions & 2 deletions 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 @@ -22,8 +22,8 @@ export default class MockWorker {
// mock expects data: { } instead of e: { data: { } }
async postMessage(data: ComputeGraphDataWorkerMessageType) {
if (data.type === 'computeGraphData') {
if (data.flagAssetSelectionSyntax) {
setFeatureFlagsInternal({flagAssetSelectionSyntax: true});
if (data.flagSelectionSyntax) {
setFeatureFlagsInternal({flagSelectionSyntax: true});
}
const state = await computeGraphData(data);
this.onmessage.forEach((onmessage) => onmessage({data: {...state, id: data.id}}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import {FeatureFlag} from 'shared/app/FeatureFlags.oss';
*/
export const DEFAULT_FEATURE_FLAG_VALUES: Partial<Record<FeatureFlag, boolean>> = {
[FeatureFlag.flagAssetSelectionWorker]: true,
[FeatureFlag.flagAssetSelectionSyntax]: new URLSearchParams(global?.location?.search ?? '').has(
[FeatureFlag.flagSelectionSyntax]: new URLSearchParams(global?.location?.search ?? '').has(
'new-asset-selection-syntax',
),
[FeatureFlag.flagRunSelectionSyntax]: new URLSearchParams(global?.location?.search ?? '').has(
'new-run-selection-syntax',
),

// Flags for tests
[FeatureFlag.__TestFlagDefaultTrue]: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export enum FeatureFlag {
flagSidebarResources = 'flagSidebarResources',
flagDisableAutoLoadDefaults = 'flagDisableAutoLoadDefaults',
flagLegacyRunsPage = 'flagLegacyRunsPage',
flagAssetSelectionSyntax = 'flagAssetSelectionSyntax',
flagRunSelectionSyntax = 'flagRunSelectionSyntax',
flagSelectionSyntax = 'flagSelectionSyntax',
flagAssetSelectionWorker = 'flagAssetSelectionWorker',
flagOpSelectionSyntax = 'flagOpSelectionSyntax',

Expand Down
8 changes: 0 additions & 8 deletions js_modules/dagster-ui/packages/ui-core/src/app/Util.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {cache} from 'idb-lru-cache';
import memoize from 'lodash/memoize';
import LRU from 'lru-cache';
import {FeatureFlag} from 'shared/app/FeatureFlags.oss';

import {featureEnabled} from './Flags';
import {timeByParts} from './timeByParts';

function twoDigit(v: number) {
Expand Down Expand Up @@ -235,12 +233,6 @@ export function assertUnreachable(value: never): never {
throw new Error(`Didn't expect to get here with value: ${JSON.stringify(value)}`);
}

export function debugLog(...args: any[]) {
if (featureEnabled(FeatureFlag.flagDebugConsoleLogging)) {
console.log(...args);
}
}

export function colorHash(str: string) {
let seed = 0;
for (let i = 0; i < str.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {debugLog, formatElapsedTimeWithMsec} from './Util';
import {ApolloLink} from '../apollo-client';

const getCalls = (response: any) => {
Expand All @@ -15,11 +14,6 @@ export const logLink = new ApolloLink((operation, forward) =>
const elapsedTime = performance.now() - context.start;
const calls = getCalls(context.response);
operation.setContext({elapsedTime, calls});
debugLog(`${operation.operationName} took ${formatElapsedTimeWithMsec(elapsedTime)}`, {
operation,
data,
calls,
});
return data;
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ export const useVisibleFeatureFlagRows = () => [
key: 'Disable automatically loading default config in launchpad',
flagType: FeatureFlag.flagDisableAutoLoadDefaults,
},
{
key: 'Debug console logging',
flagType: FeatureFlag.flagDebugConsoleLogging,
},
{
key: 'Revert to legacy Runs page',
flagType: FeatureFlag.flagLegacyRunsPage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ const AssetGraphExplorerWithData = ({
)}
<div>{filterButton}</div>
<GraphQueryInputFlexWrap>
{featureEnabled(FeatureFlag.flagAssetSelectionSyntax) ? (
{featureEnabled(FeatureFlag.flagSelectionSyntax) ? (
<AssetSelectionInput
assets={graphQueryItems}
value={explorerPath.opsQuery}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {AssetGraphFetchScope, AssetGraphQueryItem} from './useAssetGraphData';

type BaseType = {
id: number;
flagAssetSelectionSyntax?: boolean;
flagSelectionSyntax?: boolean;
};

export type ComputeGraphDataMessageType = BaseType & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type WorkerMessageData = ComputeGraphDataMessageType | BuildGraphDataMessageType
self.addEventListener('message', async (event: MessageEvent & {data: WorkerMessageData}) => {
const data: WorkerMessageData = event.data;

if (data.flagAssetSelectionSyntax) {
setFeatureFlags({[FeatureFlag.flagAssetSelectionSyntax]: true});
if (data.flagSelectionSyntax) {
setFeatureFlags({[FeatureFlag.flagSelectionSyntax]: true});
}

if (data.type === 'computeGraphData') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function useFullAssetGraphData(options: AssetGraphFetchScope) {
const requestId = ++currentRequestRef.current;
buildGraphData({
nodes: queryItems,
flagAssetSelectionSyntax: featureEnabled(FeatureFlag.flagAssetSelectionSyntax),
flagSelectionSyntax: featureEnabled(FeatureFlag.flagSelectionSyntax),
})
?.then((data) => {
if (lastProcessedRequestRef.current < requestId) {
Expand Down Expand Up @@ -172,7 +172,7 @@ export function useAssetGraphData(opsQuery: string, options: AssetGraphFetchScop
opsQuery,
kinds,
hideEdgesToNodesOutsideQuery,
flagAssetSelectionSyntax: featureEnabled(FeatureFlag.flagAssetSelectionSyntax),
flagSelectionSyntax: featureEnabled(FeatureFlag.flagSelectionSyntax),
})
?.then((data) => {
if (lastProcessedRequestRef.current < requestId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const parseAssetSelectionQuery = (

export const filterAssetSelectionByQuery = weakMapMemoize(
(all_assets: AssetGraphQueryItem[], query: string): AssetSelectionQueryResult => {
if (featureEnabled(FeatureFlag.flagAssetSelectionSyntax)) {
if (featureEnabled(FeatureFlag.flagSelectionSyntax)) {
const result = parseAssetSelectionQuery(all_assets, query);
if (result instanceof Error) {
// fall back to old behavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useAssetSelectionInput = <
/>
);

if (featureEnabled(FeatureFlag.flagAssetSelectionSyntax)) {
if (featureEnabled(FeatureFlag.flagSelectionSyntax)) {
filterInput = (
<AssetSelectionInput
value={assetSelection}
Expand Down
15 changes: 8 additions & 7 deletions js_modules/dagster-ui/packages/ui-core/src/assets/AssetView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ import {AssetPartitions} from './AssetPartitions';
import {AssetPlotsPage} from './AssetPlotsPage';
import {AssetTabs} from './AssetTabs';
import {useAllAssets} from './AssetsCatalogTable';
import {AssetAutomaterializePolicyPage} from './AutoMaterializePolicyPage/AssetAutomaterializePolicyPage';
import {AssetAutomationRoot} from './AutoMaterializePolicyPage/AssetAutomationRoot';
import {ChangedReasonsTag} from './ChangedReasons';
import {LaunchAssetExecutionButton} from './LaunchAssetExecutionButton';
import {UNDERLYING_OPS_ASSET_NODE_FRAGMENT} from './UnderlyingOpsOrGraph';
import {AssetChecks} from './asset-checks/AssetChecks';
import {assetDetailsPathForKey} from './assetDetailsPathForKey';
import {AssetNodeOverview, AssetNodeOverviewNonSDA} from './overview/AssetNodeOverview';
import {AssetKey, AssetViewParams} from './types';
import {healthRefreshHintFromLiveData} from './usePartitionHealthData';
import {useReportEventsModal} from './useReportEventsModal';
import {useWipeModal} from './useWipeModal';
import {gql, useQuery} from '../apollo-client';
import {AssetTableDefinitionFragment} from './types/AssetTableFragment.types';
import {
AssetViewDefinitionNodeFragment,
AssetViewDefinitionQuery,
AssetViewDefinitionQueryVariables,
} from './types/AssetView.types';
import {useDeleteDynamicPartitionsDialog} from './useDeleteDynamicPartitionsDialog';
import {healthRefreshHintFromLiveData} from './usePartitionHealthData';
import {useReportEventsModal} from './useReportEventsModal';
import {useWipeModal} from './useWipeModal';
import {gql, useQuery} from '../apollo-client';
import {AssetTableDefinitionFragment} from './types/AssetTableFragment.types';
import {currentPageAtom} from '../app/analytics';
import {Timestamp} from '../app/time/Timestamp';
import {AssetLiveDataRefreshButton, useAssetLiveData} from '../asset-data/AssetLiveDataProvider';
Expand Down Expand Up @@ -221,7 +221,8 @@ export const AssetView = ({assetKey, headerBreadcrumbs, writeAssetVisit, current
if (isLoading) {
return <AssetLoadingDefinitionState />;
}
return <AssetAutomaterializePolicyPage assetKey={assetKey} definition={definition} />;

return <AssetAutomationRoot assetKey={assetKey} definition={definition} />;
};

const renderChecksTab = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,10 @@ export const AssetAutomaterializePolicyPage = ({
assetKey: AssetKey;
definition?: AssetViewDefinitionNodeFragment | null;
}) => {
const {queryResult, paginationProps} = useEvaluationsQueryResult({assetKey});
const {queryResult, evaluations, paginationProps} = useEvaluationsQueryResult({assetKey});

useQueryRefreshAtInterval(queryResult, FIFTEEN_SECONDS);

const evaluations = useMemo(() => {
if (
queryResult.data?.assetConditionEvaluationRecordsOrError?.__typename ===
'AssetConditionEvaluationRecords' &&
queryResult.data?.assetNodeOrError?.__typename === 'AssetNode'
) {
return queryResult.data?.assetConditionEvaluationRecordsOrError.records;
}
return [];
}, [
queryResult.data?.assetConditionEvaluationRecordsOrError,
queryResult.data?.assetNodeOrError,
]);

const isFirstPage = !paginationProps.hasPrevCursor;

const [selectedEvaluationId, setSelectedEvaluationId] = useQueryPersistedState<
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import {
Box,
CursorHistoryControls,
NonIdealState,
SpinnerWithText,
} from '@dagster-io/ui-components';
import {useEffect, useRef} from 'react';

import {useEvaluationsQueryResult} from './useEvaluationsQueryResult';
import {FIFTEEN_SECONDS, useQueryRefreshAtInterval} from '../../app/QueryRefresh';
import {AssetKey} from '../types';
import {EvaluationList} from './EvaluationList';
import {AssetViewDefinitionNodeFragment} from '../types/AssetView.types';

interface Props {
assetKey: AssetKey;
definition: AssetViewDefinitionNodeFragment | null;
}

export const AssetAutomationRoot = ({assetKey, definition}: Props) => {
const {queryResult, evaluations, paginationProps} = useEvaluationsQueryResult({assetKey});
const {data, loading} = queryResult;

const scrollRef = useRef<HTMLDivElement>(null);

// When paginating, reset scroll to top.
useEffect(() => {
if (scrollRef.current) {
scrollRef.current.scrollTo({top: 0, behavior: 'instant'});
}
}, [paginationProps.cursor]);

useQueryRefreshAtInterval(queryResult, FIFTEEN_SECONDS);

if (loading && !data) {
return (
<Box padding={64} flex={{direction: 'column', alignItems: 'center'}}>
<SpinnerWithText label="Loading evaluations…" />
</Box>
);
}

if (!definition) {
return (
<Box padding={64}>
<NonIdealState
icon="asset"
title="Asset evaluations not found"
description="This asset does not have any automation evaluations."
/>
</Box>
);
}

return (
<>
<Box
padding={{vertical: 12, horizontal: 20}}
flex={{direction: 'row', justifyContent: 'flex-end'}}
>
<CursorHistoryControls {...paginationProps} style={{marginTop: 0}} />
</Box>
<div style={{overflowY: 'auto'}} ref={scrollRef}>
<EvaluationList
evaluations={evaluations}
assetKey={assetKey}
isPartitioned={definition.partitionDefinition !== null}
/>
</div>
</>
);
};
Loading

0 comments on commit 8c7f92b

Please sign in to comment.