Lemarais commented on a change in pull request #317:
URL: https://github.com/apache/incubator-nemo/pull/317#discussion_r706973929



##########
File path: 
runtime/executor/src/main/java/org/apache/nemo/runtime/executor/task/TaskExecutor.java
##########
@@ -123,9 +140,63 @@ public TaskExecutor(final Task task,
     this.dataFetchers = pair.left();
     this.sortedHarnesses = pair.right();
 
+    // initialize metrics
+    this.numOfReadTupleMap = new HashMap<>();
+    this.lastSerializedReadByteMap = new HashMap<>();
+    for (DataFetcher dataFetcher : dataFetchers) {
+      this.numOfReadTupleMap.put(dataFetcher.getDataSource().getId(), new 
AtomicLong());
+      this.lastSerializedReadByteMap.put(dataFetcher.getDataSource().getId(), 
0L);
+    }
+
+    // set the interval for recording stream metric
+    if (streamMetricRecordPeriod > 0) {
+      this.timeSinceLastRecordStreamMetric = System.currentTimeMillis();
+      this.periodicMetricService = Executors.newScheduledThreadPool(1);
+      this.periodicMetricService.scheduleAtFixedRate(
+        this::saveStreamMetric, 0, streamMetricRecordPeriod, 
TimeUnit.MILLISECONDS);
+    }
     this.timeSinceLastExecution = System.currentTimeMillis();
   }
 
+  // Send stream metric to the runtime master
+  private void saveStreamMetric() {

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to