Package org.apache.tez.common.counters

Examples of org.apache.tez.common.counters.TezCounters


    String destinationVertexName = "destinationVertex";
    TezDAGID dagID = TezDAGID.getInstance("2000", 1, 1);
    TezVertexID vertexID = TezVertexID.getInstance(dagID, 1);
    TezTaskID taskID = TezTaskID.getInstance(vertexID, 1);
    TezTaskAttemptID taskAttemptID = TezTaskAttemptID.getInstance(taskID, 1);
    TezCounters counters = new TezCounters();
    byte[] userPayload = TezUtils.createUserPayloadFromConf(conf);
    RuntimeTask runtimeTask = mock(RuntimeTask.class);
   
    int shufflePort = 2112;
    Map<String, String> auxEnv = new HashMap<String, String>();
View Full Code Here


  protected RuntimeTask(TaskSpec taskSpec, Configuration tezConf,
      TezUmbilical tezUmbilical) {
    this.taskSpec = taskSpec;
    this.tezConf = tezConf;
    this.tezUmbilical = tezUmbilical;
    this.tezCounters = new TezCounters();
    this.eventCounter = new AtomicInteger(0);
    this.progress = 0.0f;
    this.taskDone = new AtomicBoolean(false);
    this.counterUpdater = new TaskCounterUpdater(tezCounters, tezConf);
  }
View Full Code Here

              + (vertexName.equals("ivertex1") ? "intermediate-reducer"
                  : vertexName)
              + " Progress: " + formatter.format(vProgressFloat));
        }
        if (displayVertexCounters) {
          TezCounters counters = vStatus.getVertexCounters();
          if (counters != null) {
            System.out.println("Vertex Counters for " + vertexName + ": "
              + counters);
          }
        }
      }
    }
    if (displayDAGCounters) {
      TezCounters counters = dagStatus.getDAGCounters();
      if (counters != null) {
        System.out.println("DAG Counters: " + counters);
      }
    }
  }
View Full Code Here

      plr.getSize(), plr.getTimeStamp(),
      plr.hasPattern() ? plr.getPattern() : null);
  }

  public static TezCounters convertTezCountersFromProto(TezCountersProto proto) {
    TezCounters counters = new TezCounters();
    for (TezCounterGroupProto counterGroupProto : proto.getCounterGroupsList()) {
      CounterGroup group = counters.addGroup(counterGroupProto.getName(),
        counterGroupProto.getDisplayName());
      for (TezCounterProto counterProto :
        counterGroupProto.getCountersList()) {
        TezCounter counter = group.findCounter(
          counterProto.getName(),
View Full Code Here

      Assert.assertEquals(event.getDiagnostics(), deserializedEvent.getDiagnostics());
      Assert.assertEquals(event.getTezCounters(), deserializedEvent.getTezCounters());
      logEvents(event, deserializedEvent);
    }
    {
      TezCounters tezCounters = new TezCounters();
      tezCounters.addGroup("foo", "bar");
      tezCounters.getGroup("foo").addCounter("c1", "c1", 100);
      tezCounters.getGroup("foo").findCounter("c1").increment(1);
      DAGFinishedEvent event = new DAGFinishedEvent(
          TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 1000l, 20000l,
          DAGState.FAILED, "bad diagnostics", tezCounters);
      DAGFinishedEvent deserializedEvent = (DAGFinishedEvent)
          testProtoConversion(event);
View Full Code Here

    {
      VertexFinishedEvent event =
          new VertexFinishedEvent(TezVertexID.getInstance(
              TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111),
              "vertex1", 1000l, 15000l, 16000l, 20000l, 1344400l, VertexState.ERROR,
              "diagnose", new TezCounters(), new VertexStats());
      VertexFinishedEvent deserializedEvent = (VertexFinishedEvent)
          testProtoConversion(event);
      Assert.assertEquals(event.getVertexID(), deserializedEvent.getVertexID());
      Assert.assertEquals(event.getFinishTime(),
          deserializedEvent.getFinishTime());
View Full Code Here

          TezTaskID.getInstance(TezVertexID.getInstance(
              TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111), 1),
          "vertex1", 11000l, 1000000l,
          TezTaskAttemptID.getInstance(TezTaskID.getInstance(TezVertexID.getInstance(
              TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111), 1), 1),
          TaskState.FAILED, new TezCounters());
      TaskFinishedEvent deserializedEvent = (TaskFinishedEvent)
          testProtoConversion(event);
      Assert.assertEquals(event.getTaskID(), deserializedEvent.getTaskID());
      Assert.assertEquals(event.getFinishTime(),
          deserializedEvent.getFinishTime());
View Full Code Here

    {
      TaskAttemptFinishedEvent event = new TaskAttemptFinishedEvent(
          TezTaskAttemptID.getInstance(TezTaskID.getInstance(TezVertexID.getInstance(
              TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111), 1), 1),
          "vertex1", 10001l, 1000434444l, TaskAttemptState.FAILED,
          "diagnose", new TezCounters());
      TaskAttemptFinishedEvent deserializedEvent = (TaskAttemptFinishedEvent)
          testProtoConversion(event);
      Assert.assertEquals(event.getTaskAttemptID(),
          deserializedEvent.getTaskAttemptID());
      Assert.assertEquals(event.getFinishTime(),
View Full Code Here

      DAGClient dagClient, HiveConf conf, DAG dag) {

    /* Strings for headers and counters */
    String hiveCountersGroup = conf.getVar(conf, HiveConf.ConfVars.HIVECOUNTERGROUP);
    Set<StatusGetOpts> statusGetOpts = EnumSet.of(StatusGetOpts.GET_COUNTERS);
    TezCounters hiveCounters = null;
    try {
      hiveCounters = dagClient.getDAGStatus(statusGetOpts).getDAGCounters();
    } catch (IOException e) {
      // best attempt, shouldn't really kill DAG for this
    } catch (TezException e) {
      // best attempt, shouldn't really kill DAG for this
    }

    /* If the counters are missing there is no point trying to print progress */
    if (hiveCounters == null) {
      return;
    }

    /* Print the per Vertex summary */
    console.printInfo(SUMMARY_HEADER);
    SortedSet<String> keys = new TreeSet<String>(progressMap.keySet());
    Set<StatusGetOpts> statusOptions = new HashSet<StatusGetOpts>(1);
    statusOptions.add(StatusGetOpts.GET_COUNTERS);
    for (String vertexName : keys) {
      Progress progress = progressMap.get(vertexName);
      if (progress != null) {
        final int totalTasks = progress.getTotalTaskCount();
        final int failedTaskAttempts = progress.getFailedTaskAttemptCount();
        final int killedTasks = progress.getKilledTaskCount();
        final double duration =
            perfLogger.getDuration(PerfLogger.TEZ_RUN_VERTEX + vertexName) / 1000.0;
        VertexStatus vertexStatus = null;
        try {
          vertexStatus = dagClient.getVertexStatus(vertexName, statusOptions);
        } catch (IOException e) {
          // best attempt, shouldn't really kill DAG for this
        } catch (TezException e) {
          // best attempt, shouldn't really kill DAG for this
        }

        if (vertexStatus == null) {
          continue;
        }

        Vertex currentVertex = dag.getVertex(vertexName);
        List<Vertex> inputVerticesList = currentVertex.getInputVertices();
        long hiveInputRecordsFromOtherVertices = 0;
        if (inputVerticesList.size() > 0) {

          for (Vertex inputVertex : inputVerticesList) {
            String inputVertexName = inputVertex.getName();
            hiveInputRecordsFromOtherVertices += getCounterValueByGroupName(hiveCounters,
                hiveCountersGroup, String.format("%s_",
                    ReduceSinkOperator.Counter.RECORDS_OUT_INTERMEDIATE.toString()) +
                    inputVertexName.replace(" ", "_"));

            hiveInputRecordsFromOtherVertices += getCounterValueByGroupName(hiveCounters,
                hiveCountersGroup, String.format("%s_",
                    FileSinkOperator.Counter.RECORDS_OUT.toString()) +
                    inputVertexName.replace(" ", "_"));
          }
        }

      /*
       * Get the CPU & GC
       *
       * counters org.apache.tez.common.counters.TaskCounter
       *  GC_TIME_MILLIS=37712
       *  CPU_MILLISECONDS=2774230
       */
        final TezCounters vertexCounters = vertexStatus.getVertexCounters();
        final double cpuTimeMillis = getCounterValueByGroupName(vertexCounters,
            TaskCounter.class.getName(),
            TaskCounter.CPU_MILLISECONDS.name());

        final double gcTimeMillis = getCounterValueByGroupName(vertexCounters,
View Full Code Here

  @Override
  public TezCounters getCounters() {
    readLock.lock();
    try {
      reportedStatus.setLocalityCounter(this.localityCounter);
      TezCounters counters = reportedStatus.counters;
      if (counters == null) {
        counters = EMPTY_COUNTERS;
      }
      return counters;
    } finally {
View Full Code Here

TOP

Related Classes of org.apache.tez.common.counters.TezCounters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.