code: private void checkInProgressWork() {
          inProgressWorkQueue.addAll(db().getAllInprogressTasks());
          StatusTrail st = null;        
          while ((st = inProgressWorkQueue.removeFirst()) != null) {
              if (st.getTaskId() == null) {
                   log.info("Found task with null taskId {}.", st);
                   st.setStatus(JobStatus.not_done).setAttemptsDone(0).setGivenUp(0);
                   db().updateStatusTrail(st);
                   log.info("Marked the status as not done to ensure it is resubmitted {}", st);
                   continue;
              }
              switch(druidDriver.pollIndexerTaskStatus(st.getTaskId())) {
                  case SUCCESS:
                      newWorkQueue.remove(st);// Make sure.
                      st.setStatus(JobStatus.done);
                      st.setAttemptsDone(st.getAttemptsDone() + 1);// This will also set givenUp.
                      db().updateStatusTrail(st);
                      log.info("Task {} succeeded.", st);                    
                      break;
                  case FAILED:
                      newWorkQueue.remove(st);// Make sure.
                      st.setStatus(JobStatus.not_done);
                      st.setAttemptsDone(st.getAttemptsDone() + 1);// This will also set givenUp.
                      db().updateStatusTrail(st);
                      log.info("Task {} failed.", st);
                      break;
                  case RUNNING:
                      log.info("Task {} in progress.", st);
                      break;
                  case UNKNOWN:
                      log.info("Task {} status unknown.", st);
                      break;
              }            
          }
      }
docs: Run the jobs which are eligible to run.