From 4200dbb38851ddcaf1346400ac989e3288695e97 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Mon, 17 Jan 2022 11:34:50 -0800 Subject: [PATCH] [cuebot] Fix Group GPU APIs. (#1064) --- .../spcue/dao/postgres/GroupDaoJdbc.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/GroupDaoJdbc.java b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/GroupDaoJdbc.java index b18a67c93..948020f9f 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/GroupDaoJdbc.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/GroupDaoJdbc.java @@ -235,11 +235,6 @@ public boolean isOverMinCores(JobInterface job) { @Override public void updateDefaultJobMaxGpus(GroupInterface group, int value) { if (value <= 0) { value = CueUtil.FEATURE_DISABLED; } - if (value < CueUtil.ONE_CORE && value != CueUtil.FEATURE_DISABLED) { - String msg = "The default max cores for a job must " + - "be greater than a single core"; - throw new IllegalArgumentException(msg); - } getJdbcTemplate().update( "UPDATE folder SET int_job_max_gpus=? WHERE pk_folder=?", value, group.getId()); @@ -248,11 +243,6 @@ public void updateDefaultJobMaxGpus(GroupInterface group, int value) { @Override public void updateDefaultJobMinGpus(GroupInterface group, int value) { if (value <= 0) { value = CueUtil.FEATURE_DISABLED; } - if (value < CueUtil.ONE_CORE && value != CueUtil.FEATURE_DISABLED) { - String msg = "The default min cores for a job must " + - "be greater than a single core"; - throw new IllegalArgumentException(msg); - } getJdbcTemplate().update( "UPDATE folder SET int_job_min_gpus=? WHERE pk_folder=?", value, group.getId()); @@ -261,11 +251,6 @@ public void updateDefaultJobMinGpus(GroupInterface group, int value) { @Override public void updateMaxGpus(GroupInterface group, int value) { if (value < 0) { value = CueUtil.FEATURE_DISABLED; } - if (value < CueUtil.ONE_CORE && value != CueUtil.FEATURE_DISABLED) { - String msg = "The group max cores feature must " + - "be a whole core or greater, pass in: " + value; - throw new IllegalArgumentException(msg); - } getJdbcTemplate().update( "UPDATE folder_resource SET int_max_gpus=? WHERE pk_folder=?", @@ -452,6 +437,10 @@ public GroupDetail mapRow(ResultSet rs, int rowNum) throws SQLException { group.jobMaxGpus = rs.getInt("int_job_max_gpus"); group.jobMinGpus = rs.getInt("int_job_min_gpus"); group.jobPriority = rs.getInt("int_job_priority"); + group.minCores = rs.getInt("int_min_cores"); + group.maxCores = rs.getInt("int_max_cores"); + group.minGpus = rs.getInt("int_min_gpus"); + group.maxGpus = rs.getInt("int_max_gpus"); group.name = rs.getString("str_name"); group.parentId = rs.getString("pk_parent_folder"); group.showId = rs.getString("pk_show");