code: void cleanUpInitializedJobsList() {
      Iterator<Entry<JobID, JobInProgress>> jobsIterator = 
        initializedJobs.entrySet().iterator();
      while(jobsIterator.hasNext()) {
        Entry<JobID,JobInProgress> entry = jobsIterator.next();
        JobInProgress job = entry.getValue();
        if (job.getStatus().getRunState() == JobStatus.RUNNING) {
          if (isScheduled(job)) {
            LOG.info("Removing scheduled jobs from waiting queue"
                + job.getJobID());
            jobsIterator.remove();
            jobQueueManager.removeJobFromWaitingQueue(job);
            continue;
          }
        }
        if(job.isComplete()) {
          LOG.info("Removing killed/completed job from initalized jobs " +
          		"list : "+ job.getJobID());
          jobsIterator.remove();
        }
      }
    }
docs: Method which is used internally to clean up the initialized jobs
  data structure which the job initialization poller uses to check
  if a job is initalized or not.
  
  Algorithm for cleaning up task is as follows:
  
  <ul>
  <li> For jobs in <b>initalizedJobs</b> list </li>
  <ul>
  <li> If job is running</li>
  <ul>
  <li> If job is scheduled then remove the job from the waiting queue
  of the scheduler and <b>initalizedJobs</b>.<br/>
  The check for a job is scheduled or not is done by following
  formulae:<br/>
  if pending <i>task</i> &lt; desired <i>task</i> then scheduled else
  not scheduled.<br/>
  The formulae would return <i>scheduled</i> if one task has run or failed,
  any cases in which there has been a failure but not enough to mark task
  as failed, we return <i>not scheduled</i> in formulae.
  </li>
  </ul>
  
  <li> If job is complete, then remove the job from <b>initalizedJobs</b>.
  </li>
  
  </ul>
  </ul>