Example usage for org.apache.hadoop.mapreduce.jobhistory HistoryEvent getDatum

List of usage examples for org.apache.hadoop.mapreduce.jobhistory HistoryEvent getDatum

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce.jobhistory HistoryEvent getDatum.

Prototype

Object getDatum();

Source Link

Document

Return the Avro datum wrapped by this.

Usage

From source file:com.netflix.bdp.inviso.history.TraceJobHistoryLoader.java

License:Apache License

private void handleJobEvent(HistoryEvent event) throws IllegalArgumentException, IllegalAccessException,
        NoSuchMethodException, InvocationTargetException {
    for (Field f : event.getDatum().getClass().getFields()) {
        f.setAccessible(true);//from www .  jav a  2  s . c om

        if (Modifier.isStatic(f.getModifiers())) {
            continue;
        }

        String name = f.getName();
        Object value = f.get(event.getDatum());

        if (skipElements.contains(name)) {
            continue;
        }

        if (value instanceof CharSequence) {
            value = value.toString();
        }

        if (value == null || value.toString().trim().isEmpty()) {
            continue;
        }

        if (COUNTER_TAGS.containsKey(name)) {
            Method m = event.getClass().getDeclaredMethod(COUNTER_TAGS.get(name), new Class[0]);
            m.setAccessible(true);

            Counters counters = (Counters) m.invoke(event, new Object[0]);
            value = handleCounterEntries(counters);
        }

        job.put(name, value);
    }
}

From source file:com.netflix.bdp.inviso.history.TraceJobHistoryLoader.java

License:Apache License

private void handleTaskEvent(HistoryEvent event) throws IllegalArgumentException, IllegalAccessException,
        NoSuchMethodException, InvocationTargetException {
    Task task = new Task();

    for (Field f : event.getDatum().getClass().getFields()) {
        f.setAccessible(true);//from w  ww  . j  av a  2s .c o m

        if (Modifier.isStatic(f.getModifiers())) {
            continue;
        }

        String name = f.getName();
        Object value = f.get(event.getDatum());

        if (skipElements.contains(name)) {
            continue;
        }

        if (value instanceof CharSequence) {
            value = value.toString();
        }

        if (value == null || value.toString().trim().isEmpty()) {
            continue;
        }

        if ("counters".equals(name)) {
            Method m = event.getClass().getDeclaredMethod("getCounters", new Class[0]);
            m.setAccessible(true);

            Counters counters = (Counters) m.invoke(event, new Object[0]);
            value = handleCounterEntries(counters);
        }

        task.put(name, value);
    }

    String taskId = (String) task.get("taskid");

    job.getTask(taskId).merge(task);
}

From source file:com.netflix.bdp.inviso.history.TraceJobHistoryLoader.java

License:Apache License

private void handleAttemptEvent(HistoryEvent event) throws IllegalArgumentException, IllegalAccessException,
        NoSuchMethodException, InvocationTargetException {
    TaskAttempt attempt = new TaskAttempt();

    for (Field f : event.getDatum().getClass().getFields()) {
        f.setAccessible(true);/* www . jav  a 2s  .  co m*/

        if (Modifier.isStatic(f.getModifiers())) {
            continue;
        }

        String name = f.getName();
        Object value = f.get(event.getDatum());

        if (skipElements.contains(name)) {
            continue;
        }

        if (value instanceof CharSequence) {
            value = value.toString();
        }

        if (value == null || value.toString().trim().isEmpty()) {
            continue;
        }

        if ("counters".equals(name)) {
            Method m = event.getClass().getDeclaredMethod("getCounters", new Class[0]);
            m.setAccessible(true);

            Counters counters = (Counters) m.invoke(event, new Object[0]);
            value = handleCounterEntries(counters);
        }

        attempt.put(name, value);
    }

    Task task = job.getTask("taskid");
    task.getAttempt((String) attempt.get("attemptId")).merge(attempt);
}