From 05c351fea94a0bc486b2596e64b51582da732ce3 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Thu, 14 Oct 2021 19:02:01 -0700 Subject: [PATCH 1/2] Fix FrameCompleteHandler --- .../com/imageworks/spcue/dispatcher/FrameCompleteHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/FrameCompleteHandler.java b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/FrameCompleteHandler.java index 20afd374c..fe2482720 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/FrameCompleteHandler.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/FrameCompleteHandler.java @@ -401,7 +401,7 @@ else if (report.getHost().getNimbyLocked()) { // Then check for higher priority jobs // If not, rebook this job if (job.autoUnbook && proc.coresReserved >= 100) { - if (jobManager.isOverMinCores(job) && jobManager.isOverMinGpus(job)) { + if (jobManager.isOverMinCores(job)) { try { boolean unbook = From 755cb1ba5aba013056ea10fae28394edf07eeb64 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Thu, 14 Oct 2021 19:13:13 -0700 Subject: [PATCH 2/2] Clean up isOverMinGpus --- .../com/imageworks/spcue/dao/GroupDao.java | 8 -------- .../java/com/imageworks/spcue/dao/JobDao.java | 8 -------- .../spcue/dao/postgres/GroupDaoJdbc.java | 19 ------------------- .../spcue/dao/postgres/JobDaoJdbc.java | 16 ---------------- .../imageworks/spcue/service/JobManager.java | 8 -------- .../spcue/service/JobManagerService.java | 6 ------ 6 files changed, 65 deletions(-) diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/GroupDao.java b/cuebot/src/main/java/com/imageworks/spcue/dao/GroupDao.java index dfb49dd9c..87cd950d0 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/GroupDao.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/GroupDao.java @@ -220,14 +220,6 @@ public interface GroupDao { */ boolean isOverMinCores(JobInterface job); - /** - * Returns true if the group of the specified job is at or over its min gpus - * - * @param job - * @return - */ - boolean isOverMinGpus(JobInterface job); - /** * Returns true if the group is managed. * diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/JobDao.java b/cuebot/src/main/java/com/imageworks/spcue/dao/JobDao.java index 3882f95a7..11df75ffe 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/JobDao.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/JobDao.java @@ -273,14 +273,6 @@ public interface JobDao { */ boolean isOverMaxCores(JobInterface job, int coreUnits); - /** - * reteurns true if job is over its minimum gpus - * - * @param job - * @return boolean - */ - boolean isOverMinGpus(JobInterface job); - /** * returns true if job is over max gpus * 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 b502bb680..f09ed6e14 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 @@ -280,25 +280,6 @@ public void updateMinGpus(GroupInterface group, int value) { value, group.getId()); } - private static final String IS_OVER_MIN_GPUS = - "SELECT " + - "COUNT(1) " + - "FROM " + - "job,"+ - "folder_resource fr "+ - "WHERE " + - "job.pk_folder = fr.pk_folder " + - "AND " + - "fr.int_gpus > fr.int_min_gpus " + - "AND "+ - "job.pk_job = ?"; - - @Override - public boolean isOverMinGpus(JobInterface job) { - return getJdbcTemplate().queryForObject(IS_OVER_MIN_GPUS, - Integer.class, job.getJobId()) > 0; - } - @Override public void updateDefaultJobPriority(GroupInterface group, int value) { if (value < 0) { value = CueUtil.FEATURE_DISABLED; } diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/JobDaoJdbc.java b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/JobDaoJdbc.java index 8009b247c..890f5ea81 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/JobDaoJdbc.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/JobDaoJdbc.java @@ -662,22 +662,6 @@ public boolean isAtMaxCores(JobInterface job) { Integer.class, job.getJobId()) > 0; } - private static final String IS_JOB_OVER_MIN_GPUS = - "SELECT " + - "COUNT(1) " + - "FROM " + - "job_resource " + - "WHERE " + - "job_resource.pk_job = ? " + - "AND " + - "job_resource.int_gpus > job_resource.int_min_gpus"; - - @Override - public boolean isOverMinGpus(JobInterface job) { - return getJdbcTemplate().queryForObject(IS_JOB_OVER_MIN_GPUS, - Integer.class, job.getJobId()) > 0; - } - private static final String IS_JOB_OVER_MAX_GPUS = "SELECT " + "COUNT(1) " + diff --git a/cuebot/src/main/java/com/imageworks/spcue/service/JobManager.java b/cuebot/src/main/java/com/imageworks/spcue/service/JobManager.java index 6ab4bb38e..dfb4873b9 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/service/JobManager.java +++ b/cuebot/src/main/java/com/imageworks/spcue/service/JobManager.java @@ -292,14 +292,6 @@ public interface JobManager { */ boolean isOverMinCores(JobInterface job); - /** - * Return true if the given job is booked greater than min gpus. - * - * @param job - * @return - */ - boolean isOverMinGpus(JobInterface job); - /** * Increase the layer memory requirement to given KB value. * diff --git a/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java b/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java index a4f6f1ebb..8477916b8 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java +++ b/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java @@ -135,12 +135,6 @@ public boolean isOverMinCores(JobInterface job) { return jobDao.isOverMinCores(job); } - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly=true) - public boolean isOverMinGpus(JobInterface job) { - return jobDao.isOverMinGpus(job); - } - @Transactional(propagation = Propagation.REQUIRED, readOnly=true) public DispatchJob getDispatchJob(String id) { return jobDao.getDispatchJob(id);