Search in sources :

Example 1 with HistoryLogLevel

use of org.apache.tez.dag.api.HistoryLogLevel in project tez by apache.

the class HistoryEventHandler method shouldLogEvent.

private boolean shouldLogEvent(DAGHistoryEvent event) {
    TezDAGID dagId = event.getDagID();
    HistoryLogLevel dagLogLevel = null;
    if (dagId != null) {
        dagLogLevel = dagIdToLogLevel.get(dagId);
    }
    if (dagLogLevel == null) {
        dagLogLevel = amHistoryLogLevel;
    }
    HistoryEvent historyEvent = event.getHistoryEvent();
    HistoryEventType eventType = historyEvent.getEventType();
    if (eventType == HistoryEventType.DAG_SUBMITTED) {
        Configuration dagConf = ((DAGSubmittedEvent) historyEvent).getConf();
        dagLogLevel = HistoryLogLevel.getLogLevel(dagConf, amHistoryLogLevel);
        dagIdToLogLevel.put(dagId, dagLogLevel);
        maybeUpdateDagTaskAttemptFilters(dagId, dagLogLevel, dagConf);
    } else if (eventType == HistoryEventType.DAG_RECOVERED) {
        if (context.getCurrentDAG() != null) {
            Configuration dagConf = context.getCurrentDAG().getConf();
            dagLogLevel = HistoryLogLevel.getLogLevel(dagConf, amHistoryLogLevel);
            dagIdToLogLevel.put(dagId, dagLogLevel);
            maybeUpdateDagTaskAttemptFilters(dagId, dagLogLevel, dagConf);
        }
    } else if (eventType == HistoryEventType.DAG_FINISHED) {
        dagIdToLogLevel.remove(dagId);
        dagIdToTaskAttemptFilters.remove(dagId);
        suppressedEvents.clear();
    }
    if (dagLogLevel.shouldLog(historyEvent.getEventType().getHistoryLogLevel())) {
        return shouldLogTaskAttemptEvents(event, dagLogLevel);
    }
    return false;
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) TezDAGID(org.apache.tez.dag.records.TezDAGID) HistoryLogLevel(org.apache.tez.dag.api.HistoryLogLevel) DAGSubmittedEvent(org.apache.tez.dag.history.events.DAGSubmittedEvent)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 HistoryLogLevel (org.apache.tez.dag.api.HistoryLogLevel)1 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)1 DAGSubmittedEvent (org.apache.tez.dag.history.events.DAGSubmittedEvent)1 TezDAGID (org.apache.tez.dag.records.TezDAGID)1