diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/DispatcherDao.java b/cuebot/src/main/java/com/imageworks/spcue/dao/DispatcherDao.java index 8ca8b07e4..a2eee3657 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/DispatcherDao.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/DispatcherDao.java @@ -82,7 +82,7 @@ public interface DispatcherDao { * @param numJobs * @return */ - Set findDispatchJobsForAllShows(DispatchHost host, int numJobs); + List findDispatchJobsForAllShows(DispatchHost host, int numJobs); /** * Return a list of jobs which could use resources of the specified @@ -92,7 +92,7 @@ public interface DispatcherDao { * @param numJobs * @return */ - Set findDispatchJobs(DispatchHost host, int numJobs); + List findDispatchJobs(DispatchHost host, int numJobs); /** * Return a list of jobs which could use resources of the specified @@ -102,7 +102,7 @@ public interface DispatcherDao { * @param numJobs * @return */ - Set findDispatchJobs(DispatchHost host, GroupInterface g); + List findDispatchJobs(DispatchHost host, GroupInterface g); /** * Finds an under proced job if one exists and returns it, @@ -131,7 +131,7 @@ public interface DispatcherDao { * @param numJobs * @return */ - Set findDispatchJobs(DispatchHost host, ShowInterface show, int numJobs); + List findDispatchJobs(DispatchHost host, ShowInterface show, int numJobs); /** * Find a list of local dispatch jobs. @@ -162,6 +162,20 @@ List findNextDispatchFrames(LayerInterface layer, VirtualProc pro */ List findNextDispatchFrames(LayerInterface layer, DispatchHost host, int limit); + + /** + * Return whether FIFO scheduling is enabled or not in the same priority for unittest. + * + * @return + */ + boolean getFifoSchedulingEnabled(); + + /** + * Set whether FIFO scheduling is enabled or not in the same priority for unittest. + * + * @param fifoSchedulingEnabled + */ + void setFifoSchedulingEnabled(boolean fifoSchedulingEnabled); } diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatchQuery.java b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatchQuery.java index fb267ddbd..1f08d2153 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatchQuery.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatchQuery.java @@ -112,6 +112,22 @@ public class DispatchQuery { "AND job.pk_folder = ? "); + private static final String replaceQueryForFifo(String query) { + return query + .replace( + "JOBS_BY", + "JOBS_FIFO_BY") + .replace( + "ORDER BY job_resource.int_priority DESC", + "ORDER BY job_resource.int_priority DESC, job.ts_started ASC") + .replace( + "WHERE rank < ?", + "WHERE rank < ? ORDER BY rank"); + } + + public static final String FIND_JOBS_FIFO_BY_SHOW = replaceQueryForFifo(FIND_JOBS_BY_SHOW); + public static final String FIND_JOBS_FIFO_BY_GROUP = replaceQueryForFifo(FIND_JOBS_BY_GROUP); + /** * Dispatch a host in local booking mode. */ diff --git a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatcherDaoJdbc.java b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatcherDaoJdbc.java index 10f506e9b..d33629f18 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatcherDaoJdbc.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatcherDaoJdbc.java @@ -20,6 +20,7 @@ import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashSet; import java.util.LinkedList; @@ -28,6 +29,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.support.JdbcDaoSupport; @@ -52,6 +55,8 @@ import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_JOBS_BY_GROUP; import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_JOBS_BY_LOCAL; import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_JOBS_BY_SHOW; +import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_JOBS_FIFO_BY_GROUP; +import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_JOBS_FIFO_BY_SHOW; import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_LOCAL_DISPATCH_FRAME_BY_JOB_AND_HOST; import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_LOCAL_DISPATCH_FRAME_BY_JOB_AND_PROC; import static com.imageworks.spcue.dao.postgres.DispatchQuery.FIND_LOCAL_DISPATCH_FRAME_BY_LAYER_AND_HOST; @@ -124,6 +129,27 @@ public List getShows() { private final ConcurrentHashMap bookableShows = new ConcurrentHashMap(); + /** + * Whether or not to enable FIFO scheduling in the same priority. + */ + private boolean fifoSchedulingEnabled; + + @Autowired + public DispatcherDaoJdbc(Environment env) { + fifoSchedulingEnabled = env.getProperty( + "dispatcher.fifo_scheduling_enabled", Boolean.class, false); + } + + @Override + public boolean getFifoSchedulingEnabled() { + return fifoSchedulingEnabled; + } + + @Override + public void setFifoSchedulingEnabled(boolean fifoSchedulingEnabled) { + this.fifoSchedulingEnabled = fifoSchedulingEnabled; + } + /** * Returns a sorted list of shows that have pending jobs * which could benefit from the specified allocation. @@ -149,8 +175,8 @@ else if (cached.isExpired()) { return bookableShows.get(key).shows; } - private Set findDispatchJobs(DispatchHost host, int numJobs, boolean shuffleShows) { - LinkedHashSet result = new LinkedHashSet(); + private List findDispatchJobs(DispatchHost host, int numJobs, boolean shuffleShows) { + ArrayList result = new ArrayList(); List shows = new LinkedList(getBookableShows(host)); // shows were sorted. If we want it in random sequence, we need to shuffle it. if (shuffleShows) { @@ -185,7 +211,7 @@ private Set findDispatchJobs(DispatchHost host, int numJobs, boolean shu } result.addAll(getJdbcTemplate().query( - FIND_JOBS_BY_SHOW, + fifoSchedulingEnabled ? FIND_JOBS_FIFO_BY_SHOW : FIND_JOBS_BY_SHOW, PKJOB_MAPPER, s.getShowId(), host.getFacilityId(), host.os, host.idleCores, host.idleMemory, @@ -208,27 +234,26 @@ private Set findDispatchJobs(DispatchHost host, int numJobs, boolean shu } @Override - public Set findDispatchJobsForAllShows(DispatchHost host, int numJobs) { + public List findDispatchJobsForAllShows(DispatchHost host, int numJobs) { return findDispatchJobs(host, numJobs, true); } @Override - public Set findDispatchJobs(DispatchHost host, int numJobs) { + public List findDispatchJobs(DispatchHost host, int numJobs) { return findDispatchJobs(host, numJobs, false); } @Override - public Set findDispatchJobs(DispatchHost host, GroupInterface g) { - LinkedHashSet result = new LinkedHashSet(5); - result.addAll(getJdbcTemplate().query( - FIND_JOBS_BY_GROUP, + public List findDispatchJobs(DispatchHost host, GroupInterface g) { + List result = getJdbcTemplate().query( + fifoSchedulingEnabled ? FIND_JOBS_FIFO_BY_GROUP : FIND_JOBS_BY_GROUP, PKJOB_MAPPER, g.getGroupId(),host.getFacilityId(), host.os, host.idleCores, host.idleMemory, threadMode(host.threadMode), host.idleGpus, (host.idleGpuMemory > 0) ? 1 : 0, host.idleGpuMemory, - host.getName(), 50)); + host.getName(), 50); return result; } @@ -378,19 +403,17 @@ public boolean higherPriorityJobExists(JobDetail baseJob, VirtualProc proc) { } @Override - public Set findDispatchJobs(DispatchHost host, + public List findDispatchJobs(DispatchHost host, ShowInterface show, int numJobs) { - LinkedHashSet result = new LinkedHashSet(numJobs); - - result.addAll(getJdbcTemplate().query( - FIND_JOBS_BY_SHOW, + List result = getJdbcTemplate().query( + fifoSchedulingEnabled ? FIND_JOBS_FIFO_BY_SHOW : FIND_JOBS_BY_SHOW, PKJOB_MAPPER, show.getShowId(), host.getFacilityId(), host.os, host.idleCores, host.idleMemory, threadMode(host.threadMode), host.idleGpus, (host.idleGpuMemory > 0) ? 1 : 0, host.idleGpuMemory, - host.getName(), numJobs * 10)); + host.getName(), numJobs * 10); return result; } diff --git a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java index beacefd97..7da8faf1d 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Set; import java.util.concurrent.TimeUnit; import com.google.common.cache.Cache; @@ -126,7 +125,7 @@ private Cache getOrCreateJobLock() { } - private List dispatchJobs(DispatchHost host, Set jobs) { + private List dispatchJobs(DispatchHost host, List jobs) { List procs = new ArrayList(); try { @@ -170,8 +169,8 @@ private List dispatchJobs(DispatchHost host, Set jobs) { return procs; } - private Set getGpuJobs(DispatchHost host, ShowInterface show) { - Set jobs = null; + private List getGpuJobs(DispatchHost host, ShowInterface show) { + List jobs = null; // TODO: GPU: make index with the 4 components instead of just 3, replace the just 3 @@ -200,7 +199,7 @@ private Set getGpuJobs(DispatchHost host, ShowInterface show) { @Override public List dispatchHostToAllShows(DispatchHost host) { - Set jobs = dispatchSupport.findDispatchJobsForAllShows( + List jobs = dispatchSupport.findDispatchJobsForAllShows( host, getIntProperty("dispatcher.job_query_max")); @@ -210,7 +209,7 @@ public List dispatchHostToAllShows(DispatchHost host) { @Override public List dispatchHost(DispatchHost host) { - Set jobs = getGpuJobs(host, null); + List jobs = getGpuJobs(host, null); if (jobs == null) jobs = dispatchSupport.findDispatchJobs(host, getIntProperty("dispatcher.job_query_max")); @@ -221,7 +220,7 @@ public List dispatchHost(DispatchHost host) { @Override public List dispatchHost(DispatchHost host, ShowInterface show) { - Set jobs = getGpuJobs(host, show); + List jobs = getGpuJobs(host, show); if (jobs == null) jobs = dispatchSupport.findDispatchJobs(host, show, @@ -233,7 +232,7 @@ public List dispatchHost(DispatchHost host, ShowInterface show) { @Override public List dispatchHost(DispatchHost host, GroupInterface group) { - Set jobs = getGpuJobs(host, null); + List jobs = getGpuJobs(host, null); if (jobs == null) jobs = dispatchSupport.findDispatchJobs(host, group); diff --git a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupport.java b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupport.java index bff3dd6af..ce261535c 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupport.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupport.java @@ -306,7 +306,7 @@ List findNextDispatchFrames(LayerInterface layer, VirtualProc pro * @param host * @return */ - Set findDispatchJobsForAllShows(DispatchHost host, int numJobs); + List findDispatchJobsForAllShows(DispatchHost host, int numJobs); /** * Returns the highest priority job that can utilize @@ -315,7 +315,7 @@ List findNextDispatchFrames(LayerInterface layer, VirtualProc pro * @param host * @return */ - Set findDispatchJobs(DispatchHost host, int numJobs); + List findDispatchJobs(DispatchHost host, int numJobs); /** * Returns the highest priority jobs that can utilize @@ -324,7 +324,7 @@ List findNextDispatchFrames(LayerInterface layer, VirtualProc pro * @param host * @return A set of unique job ids. */ - Set findDispatchJobs(DispatchHost host, GroupInterface p); + List findDispatchJobs(DispatchHost host, GroupInterface p); /** * @@ -523,14 +523,14 @@ void updateProcMemoryUsage(FrameInterface frame, long rss, long maxRss, long vsi void determineIdleCores(DispatchHost host, int load); /** - * Return a set of job IDs that can take the given host. + * Return a list of job IDs that can take the given host. * * @param host * @param show * @param numJobs * @return */ - Set findDispatchJobs(DispatchHost host, ShowInterface show, int numJobs); + List findDispatchJobs(DispatchHost host, ShowInterface show, int numJobs); /** * Return true of the job has pending frames. diff --git a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java index 4a871803e..fa34e7100 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/DispatchSupportService.java @@ -148,17 +148,17 @@ public boolean higherPriorityJobExists(JobDetail baseJob, VirtualProc proc) { } @Transactional(readOnly = true) - public Set findDispatchJobsForAllShows(DispatchHost host, int numJobs) { + public List findDispatchJobsForAllShows(DispatchHost host, int numJobs) { return dispatcherDao.findDispatchJobsForAllShows(host, numJobs); } @Transactional(readOnly = true) - public Set findDispatchJobs(DispatchHost host, int numJobs) { + public List findDispatchJobs(DispatchHost host, int numJobs) { return dispatcherDao.findDispatchJobs(host, numJobs); } @Transactional(readOnly = true) - public Set findDispatchJobs(DispatchHost host, GroupInterface g) { + public List findDispatchJobs(DispatchHost host, GroupInterface g) { return dispatcherDao.findDispatchJobs(host, g); } @@ -170,7 +170,7 @@ public Set findLocalDispatchJobs(DispatchHost host) { @Override @Transactional(readOnly = true) - public Set findDispatchJobs(DispatchHost host, ShowInterface show, + public List findDispatchJobs(DispatchHost host, ShowInterface show, int numJobs) { return dispatcherDao.findDispatchJobs(host, show, numJobs); } diff --git a/cuebot/src/main/resources/opencue.properties b/cuebot/src/main/resources/opencue.properties index 4df5d601f..a446e2308 100644 --- a/cuebot/src/main/resources/opencue.properties +++ b/cuebot/src/main/resources/opencue.properties @@ -43,6 +43,8 @@ dispatcher.frame_query_max=20 dispatcher.job_frame_dispatch_max=8 # Maximum number of frames to dispatch from a host at one time. dispatcher.host_frame_dispatch_max=12 +# Whether or not to enable FIFO scheduling in the same priority. +dispatcher.fifo_scheduling_enabled=false # Jobs will be archived to the history tables after being completed for this long. history.archive_jobs_cutoff_hours=72 diff --git a/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoFifoTests.java b/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoFifoTests.java new file mode 100644 index 000000000..a428cb3ab --- /dev/null +++ b/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoFifoTests.java @@ -0,0 +1,254 @@ + +/* + * Copyright Contributors to the OpenCue Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package com.imageworks.spcue.test.dao.postgres; + +import java.io.File; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import javax.annotation.Resource; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.jdom.output.XMLOutputter; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.Rollback; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; +import org.springframework.test.context.support.AnnotationConfigContextLoader; +import org.springframework.transaction.annotation.Transactional; + +import com.imageworks.spcue.DispatchHost; +import com.imageworks.spcue.JobDetail; +import com.imageworks.spcue.config.TestAppConfig; +import com.imageworks.spcue.dao.DispatcherDao; +import com.imageworks.spcue.dao.HostDao; +import com.imageworks.spcue.dispatcher.Dispatcher; +import com.imageworks.spcue.grpc.host.HardwareState; +import com.imageworks.spcue.grpc.report.RenderHost; +import com.imageworks.spcue.service.AdminManager; +import com.imageworks.spcue.service.GroupManager; +import com.imageworks.spcue.service.HostManager; +import com.imageworks.spcue.service.JobLauncher; +import com.imageworks.spcue.service.JobManager; +import com.imageworks.spcue.test.AssumingPostgresEngine; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +@Transactional +@ContextConfiguration(classes=TestAppConfig.class, loader=AnnotationConfigContextLoader.class) +public class DispatcherDaoFifoTests extends AbstractTransactionalJUnit4SpringContextTests { + + @Autowired + @Rule + public AssumingPostgresEngine assumingPostgresEngine; + + @Resource + DispatcherDao dispatcherDao; + + @Resource + HostDao hostDao; + + @Resource + JobManager jobManager; + + @Resource + HostManager hostManager; + + @Resource + AdminManager adminManager; + + @Resource + GroupManager groupManager; + + @Resource + Dispatcher dispatcher; + + @Resource + JobLauncher jobLauncher; + + private static final String HOSTNAME="beta"; + + public DispatchHost getHost() { + return hostDao.findDispatchHost(HOSTNAME); + } + + private void launchJobs(int count) throws Exception { + Document docTemplate = new SAXBuilder(true).build( + new File("src/test/resources/conf/jobspec/jobspec_simple.xml")); + docTemplate.getDocType().setSystemID("http://localhost:8080/spcue/dtd/cjsl-1.12.dtd"); + Element root = docTemplate.getRootElement(); + Element jobTemplate = root.getChild("job"); + Element depends = root.getChild("depends"); + assertEquals(jobTemplate.getAttributeValue("name"), "test"); + root.removeContent(jobTemplate); + root.removeContent(depends); + + long t = System.currentTimeMillis(); + for (int i = 0; i < count; i++) { + Document doc = (Document) docTemplate.clone(); + root = doc.getRootElement(); + Element job = (Element) jobTemplate.clone(); + job.setAttribute("name", "job" + i); + root.addContent(job); + root.addContent((Element) depends.clone()); + jobLauncher.launch(new XMLOutputter().outputString(doc)); + + // Force to set incremental ts_started to the jobs + // because current_timestamp is not updated during test. + jdbcTemplate.update("UPDATE job SET ts_started = ? WHERE str_name = ?", + new Timestamp(t + i), "pipe-default-testuser_job" + i); + } + } + + @Before + public void launchJob() { + dispatcherDao.setFifoSchedulingEnabled(true); + + dispatcher.setTestMode(true); + jobLauncher.testMode = true; + } + + @After + public void resetFifoScheduling() { + dispatcherDao.setFifoSchedulingEnabled(false); + } + + @Before + public void createHost() { + RenderHost host = RenderHost.newBuilder() + .setName(HOSTNAME) + .setBootTime(1192369572) + .setFreeMcp(76020) + .setFreeMem(53500) + .setFreeSwap(20760) + .setLoad(1) + .setTotalMcp(195430) + .setTotalMem(8173264) + .setTotalSwap(20960) + .setNimbyEnabled(false) + .setNumProcs(2) + .setCoresPerProc(100) + .addTags("test") + .setState(HardwareState.UP) + .setFacility("spi") + .putAttributes("SP_OS", "Linux") + .build(); + + hostManager.createHost(host, + adminManager.findAllocationDetail("spi", "general")); + } + + @Test + @Transactional + @Rollback(true) + public void testFifoSchedulingEnabled() { + assertTrue(dispatcherDao.getFifoSchedulingEnabled()); + dispatcherDao.setFifoSchedulingEnabled(false); + assertFalse(dispatcherDao.getFifoSchedulingEnabled()); + dispatcherDao.setFifoSchedulingEnabled(true); + assertTrue(dispatcherDao.getFifoSchedulingEnabled()); + } + + @Test + @Transactional + @Rollback(true) + public void testAllSorted() throws Exception { + int count = 10; + launchJobs(count); + + List jobs = dispatcherDao.findDispatchJobs(getHost(), count); + assertEquals(count, jobs.size()); + for (int i = 0; i < count; i++) { + assertEquals("pipe-default-testuser_job" + i, + jobManager.getJob(jobs.get(i)).getName()); + } + } + + @Test + @Transactional + @Rollback(true) + public void testPortionSorted() throws Exception { + int count = 100; + launchJobs(count); + + int portion = 19; + List jobs = dispatcherDao.findDispatchJobs(getHost(), (portion + 1) / 10); + assertEquals(portion, jobs.size()); + for (int i = 0; i < portion; i++) { + assertEquals("pipe-default-testuser_job" + i, + jobManager.getJob(jobs.get(i)).getName()); + } + } + + @Test + @Transactional + @Rollback(true) + public void testFifoSchedulingDisabled() throws Exception { + dispatcherDao.setFifoSchedulingEnabled(false); + assertFalse(dispatcherDao.getFifoSchedulingEnabled()); + + int count = 10; + launchJobs(count); + + List jobs = dispatcherDao.findDispatchJobs(getHost(), count); + assertEquals(count, jobs.size()); + + List sortedJobs = new ArrayList(jobs); + Collections.sort(sortedJobs, + Comparator.comparing(jobId -> jobManager.getJob(jobId).getName())); + assertNotEquals(jobs, sortedJobs); + + for (int i = 0; i < count; i++) { + assertEquals("pipe-default-testuser_job" + i, + jobManager.getJob(sortedJobs.get(i)).getName()); + } + } + + @Test + @Transactional + @Rollback(true) + public void testGroup() throws Exception { + int count = 10; + launchJobs(count); + + JobDetail job = jobManager.findJobDetail("pipe-default-testuser_job0"); + assertNotNull(job); + + List jobs = dispatcherDao.findDispatchJobs(getHost(), + groupManager.getGroupDetail(job)); + assertEquals(count, jobs.size()); + for (int i = 0; i < count; i++) { + assertEquals("pipe-default-testuser_job" + i, + jobManager.getJob(jobs.get(i)).getName()); + } + } +} diff --git a/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoTests.java b/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoTests.java index a400bb26a..0a01478a4 100644 --- a/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoTests.java +++ b/cuebot/src/test/java/com/imageworks/spcue/test/dao/postgres/DispatcherDaoTests.java @@ -327,7 +327,7 @@ public void testFindDispatchJobs() { assertTrue(jdbcTemplate.queryForObject( "SELECT COUNT(*) FROM job WHERE str_state='PENDING'", Integer.class) > 0); - Set jobs = dispatcherDao.findDispatchJobs(host, 10); + List jobs = dispatcherDao.findDispatchJobs(host, 10); assertTrue(jobs.size() > 0); } @@ -341,7 +341,7 @@ public void testFindDispatchJobsByGroup() { assertNotNull(job); assertNotNull(job.groupId); - Set jobs = dispatcherDao.findDispatchJobs(host, + List jobs = dispatcherDao.findDispatchJobs(host, groupManager.getGroupDetail(job)); assertTrue(jobs.size() > 0); } @@ -354,7 +354,7 @@ public void testFindDispatchJobsByShow() { final JobDetail job = getJob1(); assertNotNull(job); - Set jobs = dispatcherDao.findDispatchJobs(host, + List jobs = dispatcherDao.findDispatchJobs(host, adminManager.findShowEntity("pipe"), 5); assertTrue(jobs.size() > 0); } @@ -517,4 +517,11 @@ public void testHigherPriorityJobExistsMaxProcBound() { boolean isHigher = dispatcherDao.higherPriorityJobExists(job1, proc); assertFalse(isHigher); } + + @Test + @Transactional + @Rollback(true) + public void testFifoSchedulingEnabled() { + assertFalse(dispatcherDao.getFifoSchedulingEnabled()); + } }