@Test public void testSeedingAndBudget() { String[] cuts = new String[] { Trivial.class.getName(), UsingSimpleAndTrivial.class.getName(), Simple.class.getName(), }; ProjectAnalyzer analyzer = new ProjectAnalyzer(cuts); ProjectStaticData data = analyzer.analyze(); int cores = 2; int memory = 1800; int budget = 3; CtgConfiguration conf = new CtgConfiguration(memory, cores, budget, 1, false, AvailableSchedule.BUDGET_AND_SEEDING); JobScheduler scheduler = new JobScheduler(data, conf); List<JobDefinition> jobs = scheduler.createNewSchedule(); Assert.assertNotNull(jobs); Assert.assertEquals("Wrong number of jobs: " + jobs.toString(), 3, jobs.size()); JobDefinition seeding = jobs.get(2); Assert.assertNotNull(seeding); Assert.assertEquals(UsingSimpleAndTrivial.class.getName(), seeding.cut); Set<String> in = seeding.inputClasses; Assert.assertNotNull(in); System.out.println(in.toString()); Assert.assertTrue(in.contains(Simple.class.getName())); Assert.assertTrue(in.contains(Trivial.class.getName())); Assert.assertEquals(2, in.size()); JobDefinition simple = jobs.get(0); Assert.assertNotNull(simple); Assert.assertEquals(Simple.class.getName(), simple.cut); int simpleTime = jobs.get(0).seconds; int trivialTime = jobs.get(1).seconds; int seedingTime = jobs.get(2).seconds; System.out.println("Ordered times: "+simpleTime+", "+trivialTime+", "+seedingTime); Assert.assertTrue(simpleTime > trivialTime); Assert.assertTrue(simpleTime < seedingTime); Assert.assertTrue(trivialTime < seedingTime); }
public List<JobDefinition> createNewSchedule(){ if(!canExecuteMore()){ logger.info("Cannot schedule more jobs"); return null; } logger.info("Creating new schedule with "+currentSchedule.getClass().getSimpleName()); List<JobDefinition> jobs = currentSchedule.createNewSchedule(); for (JobDefinition job : jobs) { ClassInfo classInfo = this.projectData.getClassInfo(job.cut); classInfo.setTimeBudgetInSeconds(job.seconds); classInfo.setMemoryInMB(job.memoryInMB); } return jobs; }
JobScheduler { public List<JobDefinition> createNewSchedule(){ if(!canExecuteMore()){ logger.info("Cannot schedule more jobs"); return null; } logger.info("Creating new schedule with "+currentSchedule.getClass().getSimpleName()); List<JobDefinition> jobs = currentSchedule.createNewSchedule(); for (JobDefinition job : jobs) { ClassInfo classInfo = this.projectData.getClassInfo(job.cut); classInfo.setTimeBudgetInSeconds(job.seconds); classInfo.setMemoryInMB(job.memoryInMB); } return jobs; } }
JobScheduler { public List<JobDefinition> createNewSchedule(){ if(!canExecuteMore()){ logger.info("Cannot schedule more jobs"); return null; } logger.info("Creating new schedule with "+currentSchedule.getClass().getSimpleName()); List<JobDefinition> jobs = currentSchedule.createNewSchedule(); for (JobDefinition job : jobs) { ClassInfo classInfo = this.projectData.getClassInfo(job.cut); classInfo.setTimeBudgetInSeconds(job.seconds); classInfo.setMemoryInMB(job.memoryInMB); } return jobs; } JobScheduler(ProjectStaticData projectData,
			CtgConfiguration conf); }
JobScheduler { public List<JobDefinition> createNewSchedule(){ if(!canExecuteMore()){ logger.info("Cannot schedule more jobs"); return null; } logger.info("Creating new schedule with "+currentSchedule.getClass().getSimpleName()); List<JobDefinition> jobs = currentSchedule.createNewSchedule(); for (JobDefinition job : jobs) { ClassInfo classInfo = this.projectData.getClassInfo(job.cut); classInfo.setTimeBudgetInSeconds(job.seconds); classInfo.setMemoryInMB(job.memoryInMB); } return jobs; } JobScheduler(ProjectStaticData projectData,
			CtgConfiguration conf); void chooseScheduleType(AvailableSchedule schedule); List<JobDefinition> createNewSchedule(); boolean canExecuteMore(); ProjectStaticData getProjectData(); CtgConfiguration getConfiguration(); }
JobScheduler { public List<JobDefinition> createNewSchedule(){ if(!canExecuteMore()){ logger.info("Cannot schedule more jobs"); return null; } logger.info("Creating new schedule with "+currentSchedule.getClass().getSimpleName()); List<JobDefinition> jobs = currentSchedule.createNewSchedule(); for (JobDefinition job : jobs) { ClassInfo classInfo = this.projectData.getClassInfo(job.cut); classInfo.setTimeBudgetInSeconds(job.seconds); classInfo.setMemoryInMB(job.memoryInMB); } return jobs; } JobScheduler(ProjectStaticData projectData,
			CtgConfiguration conf); void chooseScheduleType(AvailableSchedule schedule); List<JobDefinition> createNewSchedule(); boolean canExecuteMore(); ProjectStaticData getProjectData(); CtgConfiguration getConfiguration();  }