Skip to content

Commit

Permalink
[cuebot] Fix Group GPU APIs. (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
splhack committed Jan 17, 2022
1 parent e8b71ba commit 4200dbb
Showing 1 changed file with 4 additions and 15 deletions.
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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=?",
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 4200dbb

Please sign in to comment.