diff --git a/frontend/locales/en/strings.json b/frontend/locales/en/strings.json index b75fc3f6..168390ef 100644 --- a/frontend/locales/en/strings.json +++ b/frontend/locales/en/strings.json @@ -155,10 +155,6 @@ "label": "Subnet ID", "description": "Subnet ID for HeadNode." }, - "memoryBasedSchedulingEnabled": { - "label": "Slurm Memory Based Scheduling Enabled", - "help": "If enabled, users may use --mem to specify the amount of memory per node required by a job. For more information, see the <0>Slurm documentation for ConstrainRAMSpace" - }, "securityGroups": { "label": "Additional Security Groups", "help": "Provides additional security groups for the HeadNode." @@ -276,6 +272,24 @@ "scriptWithArgs": "You must specify a script path if you specify args.", "customAmiSelect": "You must select an AMI ID if you enable Custom AMI." }, + "container": { + "title": "Queues" + }, + "slurmMemorySettings": { + "container": { + "title": "Slurm Memory Settings", + "info": "info", + "help": "If enabled, users may use --mem to specify the amount of memory per node required by a job. For more information, see the <0>Slurm documentation for ConstrainRAMSpace" + }, + "toggle": { + "label": "Slurm Memory Based Scheduling" + }, + "info": { + "header": "Slurm Memory Based Scheduling can be enabled if only one instance type is selected", + "body": "If more than one instance type is selected in any queue, Slurm Memory Based Scheduling is disabled by default.", + "dismissAriaLabel": "Close alert" + } + }, "schedulableMemory": { "name": "Schedulable Memory (MiB)", "description": "Amount of memory in MiB to be made available to jobs on the compute nodes of the compute resource", @@ -290,6 +304,9 @@ "enableEfa": "Enable EFA", "enableGpuDirect": "Enable EFA GPUDirect RDMA" }, + "addQueueButton": { + "label": "Add queue" + }, "Gdr": { "help": "Only for p4d.24xlarge, See <0>GdrSupport." }, diff --git a/frontend/src/old-pages/Configure/HeadNode.tsx b/frontend/src/old-pages/Configure/HeadNode.tsx index 55971fcc..93e814d2 100644 --- a/frontend/src/old-pages/Configure/HeadNode.tsx +++ b/frontend/src/old-pages/Configure/HeadNode.tsx @@ -369,9 +369,6 @@ function HeadNode() { const subnetErrors = useState([...errorsPath, 'subnet']) const subnetValue = useState(subnetPath) || '' const editing = useState(['app', 'wizard', 'editing']) - const isMemoryBasedSchedulingActive = useFeatureFlag( - 'memory_based_scheduling', - ) let isSlurmAccountingActive = useFeatureFlag('slurm_accounting') const toggleImdsSecured = () => { @@ -384,34 +381,6 @@ function HeadNode() { } } - const slurmSettingsPath = [ - 'app', - 'wizard', - 'config', - 'Scheduling', - 'SlurmSettings', - ] - const memoryBasedSchedulingEnabledPath = [ - ...slurmSettingsPath, - 'EnableMemoryBasedScheduling', - ] - const memoryBasedSchedulingEnabled = useState( - memoryBasedSchedulingEnabledPath, - ) - const toggleMemoryBasedSchedulingEnabled = () => { - const setMemoryBasedSchedulingEnabled = !memoryBasedSchedulingEnabled - if (setMemoryBasedSchedulingEnabled) - setState( - memoryBasedSchedulingEnabledPath, - setMemoryBasedSchedulingEnabled, - ) - else { - clearState(memoryBasedSchedulingEnabledPath) - if (Object.keys(getState([...slurmSettingsPath])).length === 0) - clearState([...slurmSettingsPath]) - } - } - return ( Head Node Properties}> @@ -465,33 +434,6 @@ function HeadNode() { - {isMemoryBasedSchedulingActive && ( -
- - - - - - - - -
- )}
{ setState( [...queuesPath], @@ -685,20 +692,27 @@ function Queues() { } return ( - Queues}> -
- -
-
- -
-
+ + {isMemoryBasedSchedulingActive && } + {t('wizard.queues.container.title')} + } + > +
+ +
+
+ +
+
+
) } diff --git a/frontend/src/old-pages/Configure/SlurmMemorySettings.tsx b/frontend/src/old-pages/Configure/SlurmMemorySettings.tsx new file mode 100644 index 00000000..c0da22d5 --- /dev/null +++ b/frontend/src/old-pages/Configure/SlurmMemorySettings.tsx @@ -0,0 +1,119 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance +// with the License. A copy of the License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES +// OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and +// limitations under the License. + +import * as React from 'react' +import {Trans, useTranslation} from 'react-i18next' +import { + Container, + Header, + Alert, + Toggle, + SpaceBetween, + Popover, + Link, +} from '@awsui/components-react' +import {setState, getState, useState, clearState} from '../../store' + +function SlurmMemorySettings() { + const {t} = useTranslation() + const [infoAlertVisible, setInfoAlertVisible] = React.useState(false) + const slurmSettingsPath = [ + 'app', + 'wizard', + 'config', + 'Scheduling', + 'SlurmSettings', + ] + const memoryBasedSchedulingEnabledPath = [ + ...slurmSettingsPath, + 'EnableMemoryBasedScheduling', + ] + const memoryBasedSchedulingEnabled = useState( + memoryBasedSchedulingEnabledPath, + ) + + const toggleMemoryBasedSchedulingEnabled = () => { + const setMemoryBasedSchedulingEnabled = !memoryBasedSchedulingEnabled + if (setMemoryBasedSchedulingEnabled) + setState( + memoryBasedSchedulingEnabledPath, + setMemoryBasedSchedulingEnabled, + ) + else { + clearState(memoryBasedSchedulingEnabledPath) + if (Object.keys(getState([...slurmSettingsPath])).length === 0) + clearState([...slurmSettingsPath]) + } + } + + return ( + + + {t('wizard.queues.slurmMemorySettings.container.title')} + + + + } + > + + {t('wizard.queues.slurmMemorySettings.container.info')} + + + + + } + > + +
+ + + +
+ setInfoAlertVisible(false)} + visible={infoAlertVisible} + dismissAriaLabel={t( + 'wizard.queues.slurmMemorySettings.info.dismissAriaLabel', + )} + dismissible + header={t('wizard.queues.slurmMemorySettings.info.header')} + > + {t('wizard.queues.slurmMemorySettings.info.body')} + +
+
+ ) +} + +export {SlurmMemorySettings}