Skip to content

Commit 059427c

Browse files
committed
fix(FR-2837): set shmem under config.resource_opts and display SHM in endpoint detail
1 parent 1154189 commit 059427c

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

react/src/components/ServiceLauncherPageContent.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -801,11 +801,13 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
801801
: undefined),
802802
},
803803
...(values.resource.shmem && {
804-
shmem:
805-
compareNumberWithUnits(values.resource.mem, '4g') > 0 &&
806-
compareNumberWithUnits(values.resource.shmem, '1g') < 0
807-
? '1g'
808-
: values.resource.shmem,
804+
resource_opts: {
805+
shmem:
806+
compareNumberWithUnits(values.resource.mem, '4g') > 0 &&
807+
compareNumberWithUnits(values.resource.shmem, '1g') < 0
808+
? '1g'
809+
: values.resource.shmem,
810+
},
809811
}),
810812
},
811813
};

react/src/pages/EndpointDetailPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import {
8585
useSemanticColorMap,
8686
BAITable,
8787
BAIFetchKeyButton,
88+
convertToBinaryUnit,
8889
} from 'backend.ai-ui';
8990
import { default as dayjs } from 'dayjs';
9091
import * as _ from 'lodash-es';
@@ -531,7 +532,12 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
531532
_.map(endpoint_auto_scaling_rules?.edges, (edge) => edge?.node),
532533
);
533534

534-
const resource_opts = JSON.parse(endpoint?.resource_opts || '{}');
535+
const parsedResourceOpts = JSON.parse(endpoint?.resource_opts || '{}');
536+
const resource_opts = {
537+
shmem: parsedResourceOpts.shmem
538+
? convertToBinaryUnit(parsedResourceOpts.shmem, '')?.number
539+
: undefined,
540+
};
535541

536542
const items: DescriptionsItemType[] = [
537543
{

0 commit comments

Comments
 (0)