code: public synchronized void notifyTaskCompletion(long jobId, int taskId, Object result) {
      Pair<Long, Integer> id = new Pair<>(jobId, taskId);
      TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
      taskInfo.setStatus(Status.COMPLETED);
      try {
        taskInfo.setResult(ByteString.copyFrom(SerializationUtils.serialize(result)));
      } catch (IOException e) {
        // TODO(yupeng) better error handling
        LOG.warn("Failed to serialize {} : {}", result, e.getMessage());
        LOG.debug("Exception: ", e);
      } finally {
        finishTask(id);
        LOG.info("Task {} for job {} completed.", taskId, jobId);
      }
    }
docs: Notifies the completion of the task.
  
  @param jobId the job id
  @param taskId the task id
  @param result the task execution result