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

add pool tag to display for ops / assets #26804

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 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 @@ -6,6 +6,7 @@ export enum FeatureFlag {
flagLegacyRunsPage = 'flagLegacyRunsPage',
flagSelectionSyntax = 'flagSelectionSyntax',
flagAssetSelectionWorker = 'flagAssetSelectionWorker',
flagPoolUI = 'flagPoolUI',

// Flags for tests
__TestFlagDefaultNone = '__TestFlagDefaultNone',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ export const useVisibleFeatureFlagRows = () => [
</>
),
},
{
key: 'Enable pool concurrency UI',
flagType: FeatureFlag.flagPoolUI,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ const SIDEBAR_ASSET_FRAGMENT = gql`
backfillPolicy {
description
}
pools
partitionDefinition {
description
}
Expand Down

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 @@ -313,6 +313,7 @@ export const ASSET_NODE_DEFINITION_FRAGMENT = gql`
jobNames
isMaterializable
isExecutable
pools
tags {
key
value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {ExecuteChecksButton} from './asset-checks/ExecuteChecksButton';
import {assetDetailsPathForAssetCheck, assetDetailsPathForKey} from './assetDetailsPathForKey';
import {useGroupedEvents} from './groupByPartition';
import {RecentAssetEvents} from './useRecentAssetEvents';
import {useFeatureFlags} from '../app/Flags';
import {LiveDataForNodeWithStaleData} from '../asset-graph/Utils';
import {SidebarAssetFragment} from '../asset-graph/types/SidebarAssetInfo.types';
import {PoolTag} from '../instance/PoolTag';
import {SidebarSection} from '../pipelines/SidebarComponents';

interface Props {
Expand Down Expand Up @@ -42,6 +44,8 @@ export const AssetSidebarActivitySummary = ({

const grouped = useGroupedEvents(xAxis, materializations, observations, loadedPartitionKeys);
const displayedEvent = isObservable ? observations[0] : materializations[0];
const pools = asset.pools || [];
const {flagPoolUI} = useFeatureFlags();

useEffect(() => {
refetch();
Expand All @@ -60,6 +64,16 @@ export const AssetSidebarActivitySummary = ({
</>
)}

{flagPoolUI && pools.length ? (
<SidebarSection title={pools.length === 1 ? 'Pool' : 'Pools'}>
<Box margin={{horizontal: 24, vertical: 12}} flex={{gap: 4}}>
{pools.map((pool, idx) => (
<PoolTag key={idx} pool={pool} />
))}
</Box>
</SidebarSection>
) : null}

{asset.freshnessPolicy && (
<SidebarSection title="Freshness policy">
<Box margin={{horizontal: 24, vertical: 12}} flex={{gap: 12, alignItems: 'flex-start'}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ASSET_TABLE_DEFINITION_FRAGMENT = gql`
key
value
}
pools
jobNames
kinds
repository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {Link} from 'react-router-dom';
import {metadataForAssetNode} from '../AssetMetadata';
import {AttributeAndValue, SectionSkeleton} from './Common';
import {showCustomAlert} from '../../app/CustomAlertProvider';
import {useFeatureFlags} from '../../app/Flags';
import {COMMON_COLLATOR} from '../../app/Util';
import {DagsterTypeSummary} from '../../dagstertype/DagsterType';
import {PoolTag} from '../../instance/PoolTag';
import {RepoAddress} from '../../workspace/types';
import {workspacePathFromAddress} from '../../workspace/workspacePath';
import {UnderlyingOpsOrGraph} from '../UnderlyingOpsOrGraph';
Expand All @@ -19,12 +21,14 @@ export const ComputeDetailsSection = ({
repoAddress: RepoAddress | null;
assetNode: AssetNodeDefinitionFragment | null | undefined;
}) => {
const {flagPoolUI} = useFeatureFlags();
if (!assetNode) {
return <SectionSkeleton />;
}
const {assetType} = metadataForAssetNode(assetNode);
const configType = assetNode?.configField?.configType;
const assetConfigSchema = configType && configType.key !== 'Any' ? configType : null;
const pools = assetNode.pools || [];

return (
<Box flex={{direction: 'column', gap: 12}}>
Expand All @@ -38,6 +42,16 @@ export const ComputeDetailsSection = ({
</Tag>
</AttributeAndValue>

<AttributeAndValue label={pools.length > 1 ? 'Pools' : 'Pool'}>
{flagPoolUI && pools.length > 0 ? (
<Box flex={{gap: 4}}>
{pools.map((pool, idx) => (
<PoolTag key={idx} pool={pool} />
))}
</Box>
) : null}
Copy link
Member

Choose a reason for hiding this comment

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

Should there be any kind of content for the 0 case?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so...

Copy link
Member

Choose a reason for hiding this comment

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

Maybe None or something? Or not show the section?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the AttributeAndValue already does this (hides the section)?

</AttributeAndValue>

<AttributeAndValue label="Code version">{assetNode.opVersion}</AttributeAndValue>

<AttributeAndValue label="Resources">
Expand Down

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

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

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

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 @@ -963,6 +963,7 @@ const CONCURRENCY_LIMIT_FRAGMENT = gql`
fragment ConcurrencyLimitFragment on ConcurrencyKeyInfo {
concurrencyKey
slotCount
limit
claimedSlots {
runId
stepKey
Expand Down Expand Up @@ -1019,7 +1020,7 @@ export const FREE_CONCURRENCY_SLOTS_MUTATION = gql`
}
`;

const CONCURRENCY_KEY_DETAILS_QUERY = gql`
export const CONCURRENCY_KEY_DETAILS_QUERY = gql`
query ConcurrencyKeyDetailsQuery($concurrencyKey: String!) {
instance {
id
Expand Down
39 changes: 39 additions & 0 deletions js_modules/dagster-ui/packages/ui-core/src/instance/PoolTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {Box, Icon, Tag, Tooltip} from '@dagster-io/ui-components';
import {Link} from 'react-router-dom';

import {CONCURRENCY_KEY_DETAILS_QUERY} from './InstanceConcurrency';
import {useQuery} from '../apollo-client';
import {
ConcurrencyKeyDetailsQuery,
ConcurrencyKeyDetailsQueryVariables,
} from './types/InstanceConcurrency.types';

export const PoolTag = ({pool}: {pool: string}) => {
const path = `/deployment/concurrency/${pool}`;
const {data} = useQuery<ConcurrencyKeyDetailsQuery, ConcurrencyKeyDetailsQueryVariables>(
CONCURRENCY_KEY_DETAILS_QUERY,
{
variables: {
concurrencyKey: pool,
},
},
);

const concurrencyLimit = data?.instance.concurrencyLimit;
return (
<Tag intent={concurrencyLimit && concurrencyLimit.limit === null ? 'warning' : 'none'}>
<Box flex={{gap: 4, alignItems: 'center'}}>
<Icon name="dynamic_feed" />
<Link to={path}>{pool}</Link>
{concurrencyLimit && concurrencyLimit.limit === null ? (
<Tooltip
placement="top"
content="This pool currently does not have any slots configured."
>
<Icon name="warning_outline" />
</Tooltip>
) : null}
</Box>
</Tag>
);
};

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

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

Loading
Loading