public void write(org.apache.thrift7.protocol.TProtocol oprot) throws org.apache.thrift7.TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.supervisors != null) { oprot.writeFieldBegin(SUPERVISORS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift7.protocol.TList( org.apache.thrift7.protocol.TType.STRUCT, this.supervisors.size())); for (SupervisorSummary _iter43 : this.supervisors) { _iter43.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldBegin(NIMBUS_UPTIME_SECS_FIELD_DESC); oprot.writeI32(this.nimbus_uptime_secs); oprot.writeFieldEnd(); if (this.topologies != null) { oprot.writeFieldBegin(TOPOLOGIES_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift7.protocol.TList( org.apache.thrift7.protocol.TType.STRUCT, this.topologies.size())); for (TopologySummary _iter44 : this.topologies) { _iter44.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (this.version != null) { if (is_set_version()) { oprot.writeFieldBegin(VERSION_FIELD_DESC); oprot.writeString(this.version); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public boolean metrics(Client client, long now, MetricsState state, String message) throws Exception { ClusterSummary summary = client.getClusterInfo(); long time = now - state.lastTime; state.lastTime = now; int numSupervisors = summary.get_supervisors_size(); int totalSlots = 0; int totalUsedSlots = 0; ////////// // String namaSupervisor = ""; for (SupervisorSummary sup : summary.get_supervisors()) { totalSlots += sup.get_num_workers(); totalUsedSlots += sup.get_num_used_workers(); // namaSupervisor = namaSupervisor + sup.get_host() + ","; } // System.out.println(namaSupervisor); int slotsUsedDiff = totalUsedSlots - state.slotsUsed; state.slotsUsed = totalUsedSlots; int numTopologies = summary.get_topologies_size(); long totalTransferred = 0; int totalExecutors = 0; int executorsWithMetrics = 0; for (TopologySummary ts : summary.get_topologies()) { String id = ts.get_id(); TopologyInfo info = client.getTopologyInfo(id); //// SOE Addition PerftestWriter.print(summary, info, new HashMap<String, Long>()); //// for (ExecutorSummary es : info.get_executors()) { ExecutorStats stats = es.get_stats(); totalExecutors++; if (stats != null) { Map<String, Map<String, Long>> transferred = stats.get_emitted(); /* .get_transferred();*/ if (transferred != null) { Map<String, Long> e2 = transferred.get(":all-time"); if (e2 != null) { executorsWithMetrics++; // The SOL messages are always on the default stream, so just count those Long dflt = e2.get("default"); if (dflt != null) { totalTransferred += dflt; } } } } } } // long transferredDiff = totalTransferred - state.transferred; state.transferred = totalTransferred; // double throughput = (transferredDiff == 0 || time == 0) ? 0.0 : (transferredDiff * // size)/(1024.0 * 1024.0)/(time/1000.0); // System.out.println(message+"\t"+numTopologies+"\t"+totalSlots+"\t"+totalUsedSlots+"\t"+totalExecutors+"\t"+executorsWithMetrics+"\t"+now+"\t"+time+"\t"+transferredDiff+"\t"+throughput); System.out.println( message + "," + totalSlots + "," + totalUsedSlots + "," + totalExecutors + "," + executorsWithMetrics + "," + time + ",NOLIMIT"); if ("WAITING".equals(message)) { // System.err.println(" !("+totalUsedSlots+" > 0 && "+slotsUsedDiff+" == 0 && // "+totalExecutors+" > 0 && "+executorsWithMetrics+" >= "+totalExecutors+")"); } return !(totalUsedSlots > 0 && slotsUsedDiff == 0 && totalExecutors > 0 && executorsWithMetrics >= totalExecutors); }
public void read(org.apache.thrift7.protocol.TProtocol iprot) throws org.apache.thrift7.TException { org.apache.thrift7.protocol.TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift7.protocol.TType.STOP) { break; } switch (field.id) { case 1: // SUPERVISORS if (field.type == org.apache.thrift7.protocol.TType.LIST) { { org.apache.thrift7.protocol.TList _list37 = iprot.readListBegin(); this.supervisors = new ArrayList<SupervisorSummary>(_list37.size); for (int _i38 = 0; _i38 < _list37.size; ++_i38) { SupervisorSummary _elem39; // required _elem39 = new SupervisorSummary(); _elem39.read(iprot); this.supervisors.add(_elem39); } iprot.readListEnd(); } } else { org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 2: // NIMBUS_UPTIME_SECS if (field.type == org.apache.thrift7.protocol.TType.I32) { this.nimbus_uptime_secs = iprot.readI32(); set_nimbus_uptime_secs_isSet(true); } else { org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 3: // TOPOLOGIES if (field.type == org.apache.thrift7.protocol.TType.LIST) { { org.apache.thrift7.protocol.TList _list40 = iprot.readListBegin(); this.topologies = new ArrayList<TopologySummary>(_list40.size); for (int _i41 = 0; _i41 < _list40.size; ++_i41) { TopologySummary _elem42; // required _elem42 = new TopologySummary(); _elem42.read(iprot); this.topologies.add(_elem42); } iprot.readListEnd(); } } else { org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 4: // VERSION if (field.type == org.apache.thrift7.protocol.TType.STRING) { this.version = iprot.readString(); } else { org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); validate(); }