Get the task Map which the task is alive and will be kept only when type is ASSIGN_TYPE_MONITOR, it is valid

@param defaultContext default topology context
@param needAssigns    a set of tasks to be assigned
@return a set of assigned slots
507652
public Set<ResourceWorkerSlot> getKeepAssign(DefaultTopologyAssignContext defaultContext, Set<Integer> needAssigns) {
        Set<Integer> keepAssignIds = new HashSet<>();
        keepAssignIds.addAll(defaultContext.getAllTaskIds());
        keepAssignIds.removeAll(defaultContext.getUnstoppedTaskIds());
        keepAssignIds.removeAll(needAssigns);
        Set<ResourceWorkerSlot> keeps = new HashSet<>();
        if (keepAssignIds.isEmpty()) {
            return keeps;
        }

        Assignment oldAssignment = defaultContext.getOldAssignment();
        if (oldAssignment == null) {
            return keeps;
        }
        keeps.addAll(defaultContext.getOldWorkers());
        for (ResourceWorkerSlot worker : defaultContext.getOldWorkers()) {
            for (Integer task : worker.getTasks()) {
                if (!keepAssignIds.contains(task)) {
                    keeps.remove(worker);
                    break;
                }
            }
        }
        return keeps;
    }
1093444
public TaskDefinition withRequiresCompatibilities(Compatibility... requiresCompatibilities) {
        com.amazonaws.internal.SdkInternalList<String> requiresCompatibilitiesCopy = new com.amazonaws.internal.SdkInternalList<String>(
                requiresCompatibilities.length);
        for (Compatibility value : requiresCompatibilities) {
            requiresCompatibilitiesCopy.add(value.toString());
        }
        if (getRequiresCompatibilities() == null) {
            setRequiresCompatibilities(requiresCompatibilitiesCopy);
        } else {
            getRequiresCompatibilities().addAll(requiresCompatibilitiesCopy);
        }
        return this;
    }
532534
public static Map<FieldType, String> getDefaultWbsFieldMap()
   {
      Map<FieldType, String> map = new LinkedHashMap<FieldType, String>();

      map.put(TaskField.UNIQUE_ID, "wbs_id");
      map.put(TaskField.GUID, "guid");
      map.put(TaskField.NAME, "wbs_name");
      map.put(TaskField.BASELINE_COST, "orig_cost");
      map.put(TaskField.REMAINING_COST, "indep_remain_total_cost");
      map.put(TaskField.REMAINING_WORK, "indep_remain_work_qty");
      map.put(TaskField.DEADLINE, "anticip_end_date");
      map.put(TaskField.DATE1, "suspend_date");
      map.put(TaskField.DATE2, "resume_date");
      map.put(TaskField.TEXT1, "task_code");
      map.put(TaskField.WBS, "wbs_short_name");

      return map;
   }
951769
@Override
  public Object processTask(String taskName, Map<String, String[]> parameterMap) {

    if ("createAdmin".equalsIgnoreCase(taskName)) {
      return userService.createDefaultAdmin();
    }

    return null;

  }
878982
@Override
	public List<TaskSummary> getTasksAssignedAsBusinessAdministrator(String userId, String language) {
		return delegate.getTasksAssignedAsBusinessAdministrator(userId, language);
	}
688752
@Trivial
    Map<String, String> getExecutionProperties(Object task) {
        Map<String, String> execProps = task instanceof ManagedTask ? ((ManagedTask) task).getExecutionProperties() : null;
        if (execProps == null)
            execProps = defaultExecProps;
        else {
            Map<String, String> mergedProps = new TreeMap<String, String>(defaultExecProps);
            mergedProps.putAll(execProps);
            execProps = mergedProps;
        }
        return execProps;
    }
938303
public static AutoAssignStrategy getAutoAssignStrategy(String logicalName) throws StrategyException {
        TaskInstanceStrategyFactory factory = getInstance();
        String className = factory.getStrategyClassName(logicalName, StrategyType.AutoAssignStrategy);
        return (AutoAssignStrategy) factory.getStrategyInstance(AutoAssignStrategy.class, className, null);
    }
1340641
public boolean matchesAssignment(WorkerHeartbeat whb, Map<Integer, LocalAssignment> assignedTasks) {
        boolean isMatch = true;
        LocalAssignment localAssignment = assignedTasks.get(whb.getPort());
        if (localAssignment == null) {
            LOG.debug("Following worker has been removed, port=" + whb.getPort() + ", assignedTasks=" + assignedTasks);
            isMatch = false;
        } else if (!whb.getTopologyId().equals(localAssignment.getTopologyId())) {
            // topology id not equal
            LOG.info("topology id not equal whb=" + whb.getTopologyId() + ",localAssignment=" + localAssignment.getTopologyId());
            isMatch = false;
        }/*
          * else if (!(whb.getTaskIds().equals(localAssignment.getTaskIds()))) { // task-id isn't equal LOG.info("task-id isn't equal whb=" + whb.getTaskIds() +
          * ",localAssignment=" + localAssignment.getTaskIds()); isMatch = false; }
          */

        return isMatch;
    }
227398
private DefaultServiceDefaultsContext resolveServiceDefaults(ServiceDefaultsType serviceDefaults, RealmsContext realmsContext) {

        if (serviceDefaults == null) {
            return null;
        }

        DefaultAcceptOptionsContext acceptOptions = null;

        ServiceAcceptOptionsType serviceAcceptOptions = serviceDefaults.getAcceptOptions();
        if (serviceAcceptOptions != null) {
            acceptOptions = new DefaultAcceptOptionsContext(null, serviceAcceptOptions);
        }

        DefaultConnectOptionsContext connectOptions = null;
        ServiceConnectOptionsType serviceConnectOptions = serviceDefaults.getConnectOptions();
        if (serviceConnectOptions != null) {
            connectOptions = new DefaultConnectOptionsContext(null, serviceConnectOptions);
        }

        Map<String, String> mimeMappings = null;

        MimeMappingType[] mimeMappingTypes = serviceDefaults.getMimeMappingArray();
        if (mimeMappingTypes != null) {
            mimeMappings = new HashMap<>();
            for (MimeMappingType mmt : mimeMappingTypes) {
                mimeMappings.put(mmt.getExtension(), mmt.getMimeType());
            }
        }

        return new DefaultServiceDefaultsContext(acceptOptions, connectOptions, mimeMappings);
    }
274269
@Override
	public void setup(PactTaskContext<GenericCoGrouper<IT1, IT2, OT>, OT> context) {
		this.taskContext = context;
		this.running = true;
	}
298933
public String requeuePendingTasksByTaskType(String taskType) {
        Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
        return postForEntity("tasks/queue/requeue/{taskType}", null, null, String.class, taskType);
    }
1179225
@VisibleForTesting
  static Map<Integer, Container> getContainers(
      PackingPlan currentPackingPlan, Resource maxContainerResource, Resource padding,
      Map<String, TreeSet<Integer>> componentIndexes, TreeSet<Integer> taskIds) {
    Map<Integer, Container> containers = new HashMap<>();

    Resource capacity = maxContainerResource;
    for (PackingPlan.ContainerPlan currentContainerPlan : currentPackingPlan.getContainers()) {
      Container container =
          new Container(currentContainerPlan.getId(), capacity, padding);
      for (PackingPlan.InstancePlan instancePlan : currentContainerPlan.getInstances()) {
        addToContainer(container, instancePlan, componentIndexes, taskIds);
      }
      containers.put(currentContainerPlan.getId(), container);
    }
    return containers;
  }
1156006
public java.util.List<String> getTaskSets() {
        if (taskSets == null) {
            taskSets = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return taskSets;
    }
1206565
@Override
  public boolean needsTaskCommit(TaskAttemptContext context
                                 ) throws IOException {
    return workPath != null && outputFileSystem.exists(workPath);
  }
290592
public TaskSubmissionResult startTask() {

		final AllocatedResource ar = this.allocatedResource.get();

		if (ar == null) {
			final TaskSubmissionResult result = new TaskSubmissionResult(getID(),
				AbstractTaskResult.ReturnCode.NO_INSTANCE);
			result.setDescription("Assigned instance of vertex " + this.toString() + " is null!");
			return result;
		}

		final List<TaskDeploymentDescriptor> tasks = new SerializableArrayList<TaskDeploymentDescriptor>();
		tasks.add(constructDeploymentDescriptor());

		try {
			final List<TaskSubmissionResult> results = ar.getInstance().submitTasks(tasks);

			return results.get(0);

		} catch (IOException e) {
			final TaskSubmissionResult result = new TaskSubmissionResult(getID(),
				AbstractTaskResult.ReturnCode.IPC_ERROR);
			result.setDescription(StringUtils.stringifyException(e));
			return result;
		}
	}
1042495
public Set<Integer> getUnstoppedSlots(Set<Integer> aliveTasks, Map<String, SupervisorInfo> supInfos,
                                          Assignment existAssignment) {
        Set<Integer> ret = new HashSet<>();

        Set<ResourceWorkerSlot> oldWorkers = existAssignment.getWorkers();
        Set<String> aliveSupervisors = supInfos.keySet();
        for (ResourceWorkerSlot worker : oldWorkers) {
            for (Integer taskId : worker.getTasks()) {
                if (!aliveTasks.contains(taskId)) {
                    // task is dead
                    continue;
                }

                String oldTaskSupervisorId = worker.getNodeId();
                if (!aliveSupervisors.contains(oldTaskSupervisorId)) {
                    // supervisor is dead
                    ret.add(taskId);
                }
            }
        }

        return ret;
    }
757539
public Task getTask(ExecutionAttemptID executionAttemptID) {
		TaskSlotMapping taskSlotMapping = taskSlotMappings.get(executionAttemptID);

		if (taskSlotMapping != null) {
			return taskSlotMapping.getTask();
		} else {
			return null;
		}
	}