Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.
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
25 changes: 21 additions & 4 deletions frontend/locales/en/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>--mem</i> to specify the amount of memory per node required by a job. For more information, see the <0>Slurm documentation for ConstrainRAMSpace</0>"
},
"securityGroups": {
"label": "Additional Security Groups",
"help": "Provides additional security groups for the HeadNode."
Expand Down Expand Up @@ -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 <i>--mem</i> to specify the amount of memory per node required by a job. For more information, see the <0>Slurm documentation for ConstrainRAMSpace</0>"
},
"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",
Expand All @@ -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</0>."
},
Expand Down
58 changes: 0 additions & 58 deletions frontend/src/old-pages/Configure/HeadNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -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 (
<ColumnLayout columns={1}>
<Container header={<Header variant="h2">Head Node Properties</Header>}>
Expand Down Expand Up @@ -465,33 +434,6 @@ function HeadNode() {
</Trans>
</HelpTooltip>
</div>
{isMemoryBasedSchedulingActive && (
<div
key="memory-based-scheduling-enabled"
style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<Toggle
checked={memoryBasedSchedulingEnabled || false}
onChange={toggleMemoryBasedSchedulingEnabled}
>
<Trans i18nKey="wizard.headNode.memoryBasedSchedulingEnabled.label" />
</Toggle>
<HelpTooltip>
<Trans i18nKey="wizard.headNode.memoryBasedSchedulingEnabled.help">
<a
rel="noopener noreferrer"
target="_blank"
href="https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainRAMSpace"
></a>
</Trans>
</HelpTooltip>
</div>
)}
<div
key="sgs"
style={{
Expand Down
42 changes: 28 additions & 14 deletions frontend/src/old-pages/Configure/Queues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import {
} from './Components'
import HelpTooltip from '../../components/HelpTooltip'
import {Trans, useTranslation} from 'react-i18next'
import {SlurmMemorySettings} from './SlurmMemorySettings'
import {useFeatureFlag} from '../../feature-flags/useFeatureFlag'

// Constants
const queuesPath = ['app', 'wizard', 'config', 'Scheduling', 'SlurmQueues']
Expand Down Expand Up @@ -660,7 +662,12 @@ function QueuesView() {
}

function Queues() {
const {t} = useTranslation()
const isMemoryBasedSchedulingActive = useFeatureFlag(
'memory_based_scheduling',
)
let queues = useState(queuesPath) || []

const addQueue = () => {
setState(
[...queuesPath],
Expand All @@ -685,20 +692,27 @@ function Queues() {
}

return (
<Container header={<Header variant="h2">Queues</Header>}>
<div>
<QueuesView />
</div>
<div className="wizard-compute-add">
<Button
disabled={queues.length >= 5}
onClick={addQueue}
iconName={'add-plus'}
>
Add Queue
</Button>
</div>
</Container>
<ColumnLayout>
{isMemoryBasedSchedulingActive && <SlurmMemorySettings />}
<Container
header={
<Header variant="h2">{t('wizard.queues.container.title')}</Header>
}
>
<div>
<QueuesView />
</div>
<div className="wizard-compute-add">
<Button
disabled={queues.length >= 5}
onClick={addQueue}
iconName={'add-plus'}
>
{t('wizard.queues.addQueueButton.label')}
</Button>
</div>
</Container>
</ColumnLayout>
)
}

Expand Down
119 changes: 119 additions & 0 deletions frontend/src/old-pages/Configure/SlurmMemorySettings.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Container
header={
<Header variant="h2">
<SpaceBetween size="xs" direction="horizontal">
{t('wizard.queues.slurmMemorySettings.container.title')}
<Popover
dismissButton={true}
position="right"
size="small"
triggerType="custom"
content={
<Trans i18nKey="wizard.queues.slurmMemorySettings.container.help">
<a
rel="noopener noreferrer"
target="_blank"
href="https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainRAMSpace"
></a>
</Trans>
}
>
<Link variant="info">
{t('wizard.queues.slurmMemorySettings.container.info')}
</Link>
</Popover>
</SpaceBetween>
</Header>
}
>
<SpaceBetween size={'s'} direction={'vertical'}>
<div
Copy link
Contributor

Choose a reason for hiding this comment

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

question: is this div needed? I guess it can be safely removed

key="memory-based-scheduling-enabled"
style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<Toggle
checked={memoryBasedSchedulingEnabled}
onChange={toggleMemoryBasedSchedulingEnabled}
>
<Trans i18nKey="wizard.queues.slurmMemorySettings.toggle.label" />
</Toggle>
</div>
<Alert
onDismiss={() => 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')}
</Alert>
</SpaceBetween>
</Container>
)
}

export {SlurmMemorySettings}