Skip to content

[ERP-2281] Update config titles #31

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

Merged
merged 2 commits into from
Aug 5, 2024
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
12 changes: 6 additions & 6 deletions src/components/tool/guide/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const DEFAULT_CONFIG = {
ram: 16,
gpuModules: 1,
wallTime: { hour: 1, minute: 0 },
isArrayJob: "Standalone",
jobInstances: { firstIndex: 1, upperBound: 10, step: 1 },
jobInstanceType: "Standalone",
arrayConfig: { firstIndex: 1, upperBound: 10, step: 1 },
};

export const isValidChoice = (choices, value) => {
Expand Down Expand Up @@ -61,7 +61,7 @@ export const getCpuVendor = (config, onChange) => () => {
element: (key, selected) => (
<ConfigPicker
key={key}
title="CPU Vendor"
title="CPU vendor"
selected={selected}
inputProps={{
choices: cpuVendors,
Expand All @@ -87,7 +87,7 @@ export const getCpuModel = (config, onChange) => () => {
element: (key, selected) => (
<ConfigPicker
key={key}
title="CPU Model"
title="CPU model"
selected={selected}
inputProps={{
choices: cpuModels,
Expand Down Expand Up @@ -225,7 +225,7 @@ export const getGpuVendor = (config, onChange) => () => {
return (
<ConfigPicker
key={key}
title="GPU Vendor"
title="GPU vendor"
selected={selected}
inputProps={{
choices: gpuVendors,
Expand Down Expand Up @@ -259,7 +259,7 @@ export const getGpuModel = (config, onChange) => () => {
element: (key, selected) => (
<ConfigPicker
key={key}
title="GPU Model"
title="GPU model"
selected={selected}
inputProps={{
choices: gpuModels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export function EresearchInstructions({ config }) {
gpuModules={config.gpuModules}
nodes={config.nodes}
wallTime={config.wallTime}
isArrayJob={config.isArrayJob}
jobInstances={config.jobInstances}
jobInstanceType={config.jobInstanceType}
arrayConfig={config.arrayConfig}
/>
)}
</>
Expand Down
41 changes: 21 additions & 20 deletions src/components/tool/guide/EresearchJob/EresearchJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const getConfigGroups = (config, onConfigChange = () => {}) => {
element: (key, selected) => (
<ConfigPicker
key={key}
title="Job Type"
title="Job type"
description="The type of PBS job to run."
selected={selected}
inputProps={{
Expand Down Expand Up @@ -114,40 +114,41 @@ const getConfigGroups = (config, onConfigChange = () => {}) => {
selected: (config) => config?.nodes > 0,
};
},
isArrayJob: () => {
const jobInstances = [
jobInstanceType: () => {
const arrayConfig = [
["Standalone", "Run a single instance of the job"],
["Array", "Run many instances of the job in parallel"],
["Array", "Run many instances of the job"],
];
return {
element: (key, selected) => (
<ConfigPicker
key={key}
title="Job Instances"
title="Job instances"
description="Run a single instance, or many instances of the job."
selected={selected}
inputProps={{
choices: jobInstances,
value: config?.isArrayJob,
onChange: onChange("isArrayJob"),
choices: arrayConfig,
value: config?.jobInstanceType,
onChange: onChange("jobInstanceType"),
}}
/>
),
show: (config) =>
config?.service === "Lyra" && config?.jobType === "Batch",
selected: (config) => isValidChoice(jobInstances, config?.isArrayJob),
selected: (config) =>
isValidChoice(arrayConfig, config?.jobInstanceType),
};
},
jobInstances: () => {
arrayConfig: () => {
return {
element: (key, selected) => (
<ConfigMultipleNumbers
key={key}
title="Instances Config"
description="Array job settings"
title="Array range"
description="Array sub-job range indexes. The first index is the starting index, the upper bound is the last index, and the step is the increment between indexes."
selected={selected}
value={config?.jobInstances}
onChange={onChange("jobInstances")}
value={config?.arrayConfig}
onChange={onChange("arrayConfig")}
inputProps={{
min: 0,
}}
Expand All @@ -156,13 +157,13 @@ const getConfigGroups = (config, onConfigChange = () => {}) => {
show: (config) =>
config?.service === "Lyra" &&
config?.jobType === "Batch" &&
config?.isArrayJob === "Array",
config?.jobInstanceType === "Array",
selected: (config) =>
config?.jobInstances.step >= 1 &&
config?.jobInstances.upperBound >= config?.jobInstances.firstIndex &&
config?.jobInstances.upperBound > config?.jobInstances.step &&
config?.jobInstances.upperBound >=
config?.jobInstances.firstIndex + config?.jobInstances.step,
config?.arrayConfig.step >= 1 &&
config?.arrayConfig.upperBound >= config?.arrayConfig.firstIndex &&
config?.arrayConfig.upperBound > config?.arrayConfig.step &&
config?.arrayConfig.upperBound >=
config?.arrayConfig.firstIndex + config?.arrayConfig.step,
};
},
wallTime: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export const LyraArray = {
...DEFAULT_CONFIG,
service: "Lyra",
jobType: "Batch",
isArrayJob: "Array",
jobInstances: { firstIndex: 0, upperBound: 1000, step: 100 },
jobInstanceType: "Array",
arrayConfig: { firstIndex: 0, upperBound: 1000, step: 100 },
hardware: "CPU",
cpuVendor: "Any",
cpuCores: 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export function HuggingFaceInstructions({ task, model, config, port }) {
gpuModel={config.gpuModel}
gpuModules={config.gpuModules}
wallTime={config.wallTime}
isArrayJob={config.isArrayJob}
jobInstances={config.jobInstances}
jobInstanceType={config.jobInstanceType}
arrayConfig={config.arrayConfig}
/>
<InstructionInput
label="Node name"
Expand Down
12 changes: 6 additions & 6 deletions src/components/tool/guide/Instructions/StartInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function LyraStartInstructions({
gpuVendor,
gpuModel,
gpuModules,
isArrayJob,
jobInstances,
jobInstanceType,
arrayConfig,
}) {
const resources = [
`select=${jobType === "Interactive" ? 1 : nodes}`,
Expand All @@ -39,11 +39,11 @@ export function LyraStartInstructions({
const jobParameters = [
jobType === "Interactive" ? " -I -S /bin/bash" : "",
jobType !== "Interactive" && jobName !== "" ? ' -N "' + jobName + '"' : "",
jobType === "Batch" && isArrayJob === "Array"
? " -J " + jobInstances?.firstIndex + "-" + jobInstances?.upperBound
jobType === "Batch" && jobInstanceType === "Array"
? " -J " + arrayConfig?.firstIndex + "-" + arrayConfig?.upperBound
: "",
jobType === "Batch" && isArrayJob === "Array" && jobInstances?.step > 1
? ":" + jobInstances?.step
jobType === "Batch" && jobInstanceType === "Array" && arrayConfig?.step > 1
? ":" + arrayConfig?.step
: "",
];

Expand Down
Loading