Sets task state according to job state if given task is cleanup one
@param task task to handle
491461
private void setJobCleanupTaskState(Task task) {
    if (task.isJobCleanupTask()) {
      if (jobFailed) {
        task.setJobCleanupTaskState(
            org.apache.hadoop.mapreduce.JobStatus.State.FAILED);
      } else if (jobKilled) {
        task.setJobCleanupTaskState(
            org.apache.hadoop.mapreduce.JobStatus.State.KILLED);
      } else {
        task.setJobCleanupTaskState(
            org.apache.hadoop.mapreduce.JobStatus.State.SUCCEEDED);
      }
    }
  }
297712
@UnstableApi
    public final void executeAfterEventLoopIteration(Runnable task) {
        ObjectUtil.checkNotNull(task, "task");
        if (isShutdown()) {
            reject();
        }

        if (!tailTasks.offer(task)) {
            reject(task);
        }

        if (wakesUpForTask(task)) {
            wakeup(inEventLoop());
        }
    }
214668
private void setTasks(String tasks) {
		for (String task : tasks.split(",")) {
			if (KNOWN_TASKS.containsKey(task)) {
				this.tasks |= KNOWN_TASKS.get(task);
				this.taskName += (this.taskName.isEmpty() ? "" : "-") + task;
			} else {
				logger.warn("Unsupported RDF serialization task \"" + task
						+ "\". Run without specifying any tasks for help.");
			}
		}
	}
206335
def CheckTaskToMerge(self, task):
    
    with self._lock:
      is_abandoned = task.identifier in self._tasks_abandoned
      is_processing = task.identifier in self._tasks_processing
      is_queued = task.identifier in self._tasks_queued

      if not is_queued and not is_processing and not is_abandoned:
        raise KeyError('Status of task {0:s} is unknown.'.format(
            task.identifier))

      return is_queued or is_processing or is_abandoned and not task.has_retry
1343140
public void killTask(TaskAttemptID taskId) throws IOException {
    ensureState(JobState.RUNNING);
    info.killTask(org.apache.hadoop.mapred.TaskAttemptID.downgrade(taskId),
                  false);
  }
214487
public void fireTaskReadEvent(Task task)
   {
      if (m_projectListeners != null)
      {
         for (ProjectListener listener : m_projectListeners)
         {
            listener.taskRead(task);
         }
      }
   }
381617
public void fireTaskWrittenEvent(Task task)
   {
      if (m_projectListeners != null)
      {
         for (ProjectListener listener : m_projectListeners)
         {
            listener.taskWritten(task);
         }
      }
   }
1180599
private void setTaskFinish() {
        m_taskRecord.setProperty(TaskRecord.PROP_EXECUTOR, m_hostID);
        m_taskRecord.setProperty(TaskRecord.PROP_FINISH_TIME, Long.toString(System.currentTimeMillis()));
        m_taskRecord.setStatus(TaskStatus.COMPLETED);
        TaskManagerService.instance().updateTaskStatus(m_tenant, m_taskRecord, true);
    }
133297
@MainThread
    private void handleTaskFinished(Task task) {
        if (task.method.type != EventMethod.Type.SUBSCRIBE) {
            // We are not interested in finished callbacks, only finished subscriber calls
            return;
        }

        if (task.method.isSingleThread) {
            Utils.log(task, "Single-thread method is no longer in use");
            task.method.isInUse = false;
        }

        Event event = task.event;

        if (!activeEvents.contains(event)) {
            Utils.logE(event.getKey(), "Cannot finish already finished event");
            return;
        }

        ((EventBase) event).handlersCount--;

        if (((EventBase) event).handlersCount == 0) {
            // No more running handlers
            activeEvents.remove(event);
            scheduleStatusUpdates(event, EventStatus.FINISHED);
            executeTasks(false);
        }
    }
741947
protected void addTask(Runnable task) {
        if (task == null) {
            throw new NullPointerException("task");
        }
        if (!offerTask(task)) {
            reject(task);
        }
    }
385883
public void cancelScheduledTask(TimerTask task) {
		TaskEngine.TimerTaskWrapper taskWrapper = wrappedTasks.remove(task);
		if (taskWrapper != null) {
			taskWrapper.cancel();
		}
	}
34989
void performCleanUp(@Nullable Runnable task) {
    evictionLock.lock();
    try {
      maintenance(task);
    } finally {
      evictionLock.unlock();
    }
    if ((drainStatus() == REQUIRED) && (executor == ForkJoinPool.commonPool())) {
      scheduleDrainBuffers();
    }
  }
367769
public void resetTask () {
		if (status == Status.RUNNING) cancel();
		for (int i = 0, n = getChildCount(); i < n; i++) {
			getChild(i).resetTask();
		}
		status = Status.FRESH;
		tree = null;
		control = null;
	}
1123649
private void init(final Task<Revision> task)
	{
		this.partCounter++;
		this.result = new Task<Diff>(task.getHeader(), partCounter);
	}
790189
public void removeTask(AgentTask task) {
		final Iterator<WeakReference<AgentTask>> iterator = this.tasks.iterator();
		while (iterator.hasNext()) {
			final WeakReference<AgentTask> reference = iterator.next();
			final AgentTask knownTask = reference.get();
			if (knownTask == null) {
				iterator.remove();
			} else if (Objects.equals(knownTask.getName(), task.getName())) {
				iterator.remove();
				return;
			}
		}
	}
502455
public synchronized void enqueue(DownloadTask task) {
        taskList.add(task);
        Collections.sort(taskList);

        if (!paused && !looping) {
            looping = true;
            startNewLooper();
        }
    }
202690
@Override
	public void setStatusText(String status) {
		if (status != null)
			oldStatusText = task.getStatusText(0);
		else
			status = oldStatusText;
		task.setStatusText(status);
	}