tez-plugins/tez-yarn-timeline-history-with-fs/src/main/java/org/apache/tez/dag/history/logging/ats/ATSV15HistoryLoggingService.java [395:454]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      if (response != null
          && !response.getErrors().isEmpty()) {
        int count = response.getErrors().size();
        for (int i = 0; i < count; ++i) {
          TimelinePutError err = response.getErrors().get(i);
          if (err.getErrorCode() != 0) {
            LOG.warn("Could not post history event to ATS"
                + ", atsPutError=" + err.getErrorCode()
                + ", entityId=" + err.getEntityId());
          }
        }
      }
      // Do nothing additional, ATS client library should handle throttling
      // or auto-disable as needed
    } catch (Exception e) {
      LOG.warn("Could not handle history events", e);
    }
  }

  private String getDomainForEvent(DAGHistoryEvent event) {
    String domainId = sessionDomainId;
    if (historyACLPolicyManager == null) {
      return domainId;
    }

    TezDAGID dagId = event.getDAGID();
    HistoryEvent historyEvent = event.getHistoryEvent();
    if (dagId == null || !HistoryEventType.isDAGSpecificEvent(historyEvent.getEventType())) {
      return domainId;
    }

    if (dagDomainIdMap.containsKey(dagId)) {
      // If we already have the domain for the dag id return it
      domainId = dagDomainIdMap.get(dagId);
      // Cleanup if this is the last event.
      if (historyEvent.getEventType() == HistoryEventType.DAG_FINISHED) {
        dagDomainIdMap.remove(dagId);
      }
    } else if (HistoryEventType.DAG_SUBMITTED == historyEvent.getEventType()
        || HistoryEventType.DAG_RECOVERED == historyEvent.getEventType()) {
      // In case this is the first event for the dag, create and populate dag domain.
      Configuration conf;
      DAGPlan dagPlan;
      if (HistoryEventType.DAG_SUBMITTED == historyEvent.getEventType()) {
          conf = ((DAGSubmittedEvent)historyEvent).getConf();
          dagPlan = ((DAGSubmittedEvent)historyEvent).getDAGPlan();
      } else {
         conf = appContext.getCurrentDAG().getConf();
         dagPlan = appContext.getCurrentDAG().getJobPlan();
      }
      domainId = createDagDomain(conf, dagPlan, dagId);

      // createDagDomain updates skippedDAGs so another check here.
      if (skippedDAGs.contains(dagId)) {
        return null;
      }

      dagDomainIdMap.put(dagId, domainId);
    }
    return domainId;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



tez-plugins/tez-yarn-timeline-history/src/main/java/org/apache/tez/dag/history/logging/ats/ATSHistoryLoggingService.java [355:414]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      if (response != null
        && !response.getErrors().isEmpty()) {
        int count = response.getErrors().size();
        for (int i = 0; i < count; ++i) {
          TimelinePutError err = response.getErrors().get(i);
          if (err.getErrorCode() != 0) {
            LOG.warn("Could not post history event to ATS"
                + ", atsPutError=" + err.getErrorCode()
                + ", entityId=" + err.getEntityId());
          }
        }
      }
      // Do nothing additional, ATS client library should handle throttling
      // or auto-disable as needed
    } catch (Exception e) {
      LOG.warn("Could not handle history events", e);
    }
  }

  private String getDomainForEvent(DAGHistoryEvent event) {
    String domainId = sessionDomainId;
    if (historyACLPolicyManager == null) {
      return domainId;
    }

    TezDAGID dagId = event.getDAGID();
    HistoryEvent historyEvent = event.getHistoryEvent();
    if (dagId == null || !HistoryEventType.isDAGSpecificEvent(historyEvent.getEventType())) {
      return domainId;
    }

    if (dagDomainIdMap.containsKey(dagId)) {
      // If we already have the domain for the dag id return it
      domainId = dagDomainIdMap.get(dagId);
      // Cleanup if this is the last event.
      if (historyEvent.getEventType() == HistoryEventType.DAG_FINISHED) {
        dagDomainIdMap.remove(dagId);
      }
    } else if (HistoryEventType.DAG_SUBMITTED == historyEvent.getEventType()
        || HistoryEventType.DAG_RECOVERED == historyEvent.getEventType()) {
      // In case this is the first event for the dag, create and populate dag domain.
      Configuration conf;
      DAGPlan dagPlan;
      if (HistoryEventType.DAG_SUBMITTED == historyEvent.getEventType()) {
          conf = ((DAGSubmittedEvent)historyEvent).getConf();
          dagPlan = ((DAGSubmittedEvent)historyEvent).getDAGPlan();
      } else {
         conf = appContext.getCurrentDAG().getConf();
         dagPlan = appContext.getCurrentDAG().getJobPlan();
      }
      domainId = createDagDomain(conf, dagPlan, dagId);

      // createDagDomain updates skippedDAGs so another check here.
      if (skippedDAGs.contains(dagId)) {
        return null;
      }

      dagDomainIdMap.put(dagId, domainId);
    }
    return domainId;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



