Get all the tasks of the desired type in this job.
@param type {@link TaskType} of the tasks required
@return An array of {@link TaskInProgress} matching the given type.
Returns an empty array if no tasks are found for the given type.
17204
TaskInProgress[] getTasks(TaskType type) {
    TaskInProgress[] tasks = null;
    switch (type) {
      case MAP:
        {
          tasks = maps;
        }
        break;
      case REDUCE:
        {
          tasks = reduces;
        }
        break;
      case JOB_SETUP:
        {
          tasks = setup;
        }
        break;
      case JOB_CLEANUP:
        {
          tasks = cleanup;
        }
        break;
      default:
        {
          tasks = new TaskInProgress[0];
        }
        break;
    }

    return tasks;
  }
694689
public List<CloudTask> getTaskStatusForJob(final String jobId) {
    List<CloudTask> tasks = null;
    try {
      tasks = client.taskOperations().listTasks(jobId);
      LOG.log(Level.INFO, "Task status for job: {0} returned {1} tasks", new Object[]{jobId, tasks.size()});
    } catch (IOException | BatchErrorException ex) {
      LOG.log(Level.SEVERE, "Exception when fetching Task status for job: {0}. Exception [{1}]:[2]",
          new Object[]{jobId, ex.getMessage(), ex.getStackTrace()});
    }

    return tasks;
  }
415247
synchronized List<TaskStatus> getTasksFromRunningJobs() {
    List<TaskStatus> result = new ArrayList<TaskStatus>(tasks.size());
    for (Map.Entry <JobID, RunningJob> item : runningJobs.entrySet()) {
      RunningJob rjob = item.getValue();
      synchronized (rjob) {
        for (TaskInProgress tip : rjob.tasks) {
          result.add(tip.getStatus());
        }
      }
    }
    return result;
  }
252533
public List<JobInfo> findJobs(final Optional<String> type, final int count) {
        if (type.isPresent()) {
            return jobRepository.findLatestBy(type.get(), count);
        } else {
            return jobRepository.findLatest(count);
        }
    }
523162
public static List<LocalityLevel> neededLocalityLevels(ResourceType type) {
    List<LocalityLevel> l = new ArrayList<LocalityLevel>();
    switch (type) {
    case MAP:
      l.add(LocalityLevel.NODE);
      l.add(LocalityLevel.RACK);
      l.add(LocalityLevel.ANY);
      break;
    case REDUCE:
      l.add(LocalityLevel.ANY);
      break;
    case JOBTRACKER:
      l.add(LocalityLevel.ANY);
      break;
    default:
      throw new RuntimeException("Undefined locality behavior for " + type);
    }
    return l;
  }
1136133
public void incRunningTasks(String poolName, TaskType type, int inc) {
    Map<String, Integer> runningMap = (type == TaskType.MAP ?
                                       poolRunningMaps : poolRunningReduces);
    if (!runningMap.containsKey(poolName)) {
      runningMap.put(poolName, 0);
    }
    int runningTasks = runningMap.get(poolName) + inc;
    runningMap.put(poolName, runningTasks);
  }
1307076
public static void logInvalidTaskType(final Logger logger,
			final TaskTypes type)
	{

		logger.logMessage(Level.INFO, "Invalid TaskType: " + type);
	}
874262
public List<Task> getActiveTasks() {
        InputStream response = null;
        URI uri = new URIBase(getBaseUri()).path("_active_tasks").build();
        try {
            response = couchDbClient.get(uri);
            return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS);
        } finally {
            close(response);
        }
    }
507705
public Iterator<JobTaskVertex> getTaskVertices() {

		final Collection<JobTaskVertex> coll = this.taskVertices.values();

		return coll.iterator();
	}
1126379
public static synchronized List<String> getTaskList() {
        List<String> tasks;

        if (uploadTasksMap.isEmpty()) {
            tasks = new ArrayList<>(1);
        } else {
            tasks = new ArrayList<>(uploadTasksMap.size());
            tasks.addAll(uploadTasksMap.keySet());
        }

        return tasks;
    }
892190
@Override
    public List<Task> getTasks(String taskType, String startKey, int count) {
        throw new UnsupportedOperationException("This method is not implemented in CassandraExecutionDAO. Please use ExecutionDAOFacade instead.");
    }
555585
private boolean atSpeculativeCap(TaskType type) {
     float numTasks = (type == TaskType.MAP) ?
       (float)(runningMapTasks - speculativeMapTasks) :
       (float)(runningReduceTasks - speculativeReduceTasks);
     if (numTasks == 0){
       return true; // avoid divide by zero
     }
     int speculativeTaskCount = type == TaskType.MAP ? speculativeMapTasks
         : speculativeReduceTasks;
     int totalSpeculativeTaskCount = type == TaskType.MAP ?
         totalSpeculativeMapTasks.get() : totalSpeculativeReduceTasks.get();
     //return true if totalSpecTask < max(10, 0.01 * total-slots,
     //                                   0.1 * total-running-tasks)

     if (speculativeTaskCount < MIN_SPEC_CAP) {
       return false; // at least one slow tracker's worth of slots(default=10)
     }
     ClusterStatus c = jobtracker.getClusterStatus(false);
     int numSlots = (type == TaskType.MAP ? c.getMaxMapTasks() : c.getMaxReduceTasks());
     if (speculativeTaskCount < numSlots * MIN_SLOTS_CAP) {
       return false;
     }
     // Check if the total CAP has been reached
     if (totalSpeculativeTaskCount >= numSlots * TOTAL_SPECULATIVECAP) {
       return true;
     }
     boolean atCap = (((speculativeTaskCount)/numTasks) >= speculativeCap);
     if (LOG.isDebugEnabled()) {
       LOG.debug("SpeculativeCap is "+speculativeCap+", specTasks/numTasks is " +
           ((speculativeTaskCount)/numTasks)+
           ", so atSpecCap() is returning "+atCap);
     }
     return atCap;
   }
499617
public int getAvailableSlots(TaskType taskType) {
    int availableSlots = 0;
    if (taskType == TaskType.MAP) {
      if (LOG.isDebugEnabled()) {
        LOG.debug(trackerName + " getAvailSlots:" +
        		     " max(m)=" + status.getMaxMapSlots() + 
        		     " occupied(m)=" + status.countOccupiedMapSlots());
      }
      availableSlots = status.getAvailableMapSlots();
    } else {
      if (LOG.isDebugEnabled()) {
        LOG.debug(trackerName + " getAvailSlots:" +
                  " max(r)=" + status.getMaxReduceSlots() + 
                  " occupied(r)=" + status.countOccupiedReduceSlots());
      }
      availableSlots = status.getAvailableReduceSlots();
    }
    return availableSlots;
  }
611861
public TaskCompletionEvent[] getTaskCompletionEvents(int startFrom
                                                       ) throws IOException {
    ensureState(JobState.RUNNING);
    return info.getTaskCompletionEvents(startFrom);
  }
452510
public int getMaxSlots(TaskTrackerStatus status, TaskType type) {
    return (type == TaskType.MAP) ? status.getMaxMapSlots() :
        status.getMaxReduceSlots();
  }
81001
public TaskStatus getTaskStatus() {
    TaskStatusUpdate update = get(TaskStatusUpdate.class);
    if (update == null) {
      return null;
    }
    return update.getStatus();
  }
174982
public List<GraphQLObjectType> getImplementations(GraphQLInterfaceType type) {
        List<GraphQLObjectType> implementations = byInterface.get(type.getName());
        return (implementations == null)
                ? Collections.emptyList()
                : Collections.unmodifiableList(sortGraphQLTypes(implementations));
    }