From f406be6e8428be11038c7eca1a8c5a75f1d2e236 Mon Sep 17 00:00:00 2001 From: Paul Sarando Date: Fri, 27 Sep 2024 19:31:34 -0700 Subject: [PATCH] CORE-2011 Update setting max CPUs in app launch form If no default_max_cpu_cores setting is returned from the API, then set a reasonable default so the max is not automatically selected in the launch form. --- src/components/apps/launch/formatters.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/apps/launch/formatters.js b/src/components/apps/launch/formatters.js index 3914c06f2..c178eb3e0 100644 --- a/src/components/apps/launch/formatters.js +++ b/src/components/apps/launch/formatters.js @@ -35,21 +35,27 @@ const initAppLaunchValues = ( notify, notifyPeriodic, periodicPeriod, + defaultMaxCpuCores = 4, defaultOutputDir, app: { id, version_id, system_id, name, requirements, groups }, } ) => { + // If no default_max_cpu_cores is returned from the API, + // then use the default from params (if it's less than the actual max) + // so the max is not automatically selected in the launch form. const reqInitValues = requirements?.map( ({ step_number, max_cpu_cores, - default_max_cpu_cores = 0, + default_max_cpu_cores = max_cpu_cores < defaultMaxCpuCores + ? max_cpu_cores + : defaultMaxCpuCores, default_cpu_cores = 0, default_memory = 0, default_disk_space = 0, }) => ({ step_number, - max_cpu_cores: default_max_cpu_cores || max_cpu_cores, + max_cpu_cores: default_max_cpu_cores, min_cpu_cores: default_cpu_cores, min_memory_limit: default_memory, min_disk_space: default_disk_space,