chronos-agent/src/test/java/com/huffingtonpost/chronos/agent/TestAgentConsumer.java
/**
   * NOTE: sometimes the underlying OS is not happy with creating the script
   * jobs and returns "Resource temporarily unavailable"
   * @throws Exception
   */
sometimes the underlying OS is not happy with creating the script
jobs and returns "Resource temporarily unavailable"
@throws Exception
sometimes the underlying OS is not happy with creating the script jobs and returns " Resource temporarily unavailable " @throws Exception
@Ignore
  public void testQueueLarge() throws Exception {
    for (int j = 0; j < 100; j++) {
      cleanup();
      setUp();
      for (int i = 0; i < numOfConcurrentJobs-1; i++) {
        JobSpec aJob = TestAgent.getTestJob("Foucault "+i, dao);
        aJob.setShouldRerun(true);
        long id = dao.createJob(aJob);
        PlannedJob pj = new PlannedJob(dao.getJob(id),
          Utils.getCurrentTime());
        CallableJob cj = new SleepyCallableQuery(pj, dao, reporting,
          "example.com", null, null, null, drivers.get(0), 1, 10000);
        consumer.submitJob(cj);
      }
      for (int i = 0; i < numOfConcurrentJobs+1; i++) {
        JobSpec aJob = TestAgent.getTestJob("Foucault "+(numOfConcurrentJobs), dao);
        aJob.setType(JobType.Script);
        aJob.setCode("sleep 1; echo \"done\";");
        long id = dao.createJob(aJob);
        PlannedJob pj = new PlannedJob(dao.getJob(id),
          Utils.getCurrentTime());
        dao.addToQueue(pj);
      }
      assertEquals(numOfConcurrentJobs+1, dao.getQueue(null).size());
      assertEquals(0, consumer.getFinishedJobs(limit).size());
      assertEquals(0, consumer.getSuccesfulQueries(limit).size());
      assertEquals(0, consumer.getFailedQueries(limit).size());
      TestAgent.runRunnable(consumer);
      doSleep();
      TestAgent.runRunnable(consumer);
      assertEquals(numOfConcurrentJobs+1, dao.getQueue(null).size());
      assertEquals(consumer.getFinishedJobs(limit).toString(),
                   0, consumer.getFinishedJobs(limit).size());
      assertEquals(0, consumer.getSuccesfulQueries(limit).size());
      assertEquals(0, consumer.getFailedQueries(limit).size());
    }
  }
@ Ignore public void testQueueLarge ( ) throws Exception { for ( int j = 0 ; j < 100 ; j ++ ) { cleanup ( ) ; setUp ( ) ; for ( int i = 0 ; i < numOfConcurrentJobs - 1 ; i ++ ) { JobSpec aJob = TestAgent . getTestJob ( "Foucault " + i , dao ) ; aJob . setShouldRerun ( true ) ; long id = dao . createJob ( aJob ) ; PlannedJob pj = new PlannedJob ( dao . getJob ( id ) , Utils . getCurrentTime ( ) ) ; CallableJob cj = new SleepyCallableQuery ( pj , dao , reporting , "example.com" , null , null , null , drivers . get ( 0 ) , 1 , 10000 ) ; consumer . submitJob ( cj ) ; } for ( int i = 0 ; i < numOfConcurrentJobs + 1 ; i ++ ) { JobSpec aJob = TestAgent . getTestJob ( "Foucault " + ( numOfConcurrentJobs ) , dao ) ; aJob . setType ( JobType . Script ) ; aJob . setCode ( "sleep 1; echo \"done\";" ) ; long id = dao . createJob ( aJob ) ; PlannedJob pj = new PlannedJob ( dao . getJob ( id ) , Utils . getCurrentTime ( ) ) ; dao . addToQueue ( pj ) ; } assertEquals ( numOfConcurrentJobs + 1 , dao . getQueue ( null ) . size ( ) ) ; assertEquals ( 0 , consumer . getFinishedJobs ( limit ) . size ( ) ) ; assertEquals ( 0 , consumer . getSuccesfulQueries ( limit ) . size ( ) ) ; assertEquals ( 0 , consumer . getFailedQueries ( limit ) . size ( ) ) ; TestAgent . runRunnable ( consumer ) ; doSleep ( ) ; TestAgent . runRunnable ( consumer ) ; assertEquals ( numOfConcurrentJobs + 1 , dao . getQueue ( null ) . size ( ) ) ; assertEquals ( consumer . getFinishedJobs ( limit ) . toString ( ) , 0 , consumer . getFinishedJobs ( limit ) . size ( ) ) ; assertEquals ( 0 , consumer . getSuccesfulQueries ( limit ) . size ( ) ) ; assertEquals ( 0 , consumer . getFailedQueries ( limit ) . size ( ) ) ; } }
NOTE: sometimes the underlying OS is not happy with creating the script
 jobs and returns "Resource temporarily unavailable"
 @throws Exception
NOTE : sometimes the underlying OS is not happy with creating the script jobs and returns " Resource temporarily unavailable " @throws Exception
// queue up some long-running jobs // 1 that will get dequeued and some extra // make sure queue is populated with extra