arne-alex commented on code in PR #23333:
URL: https://github.com/apache/beam/pull/23333#discussion_r997817810
##########
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/FakeWindmillServer.java:
##########
@@ -280,7 +329,20 @@ public Windmill.GlobalData
requestGlobalData(Windmill.GlobalDataRequest request)
}
@Override
- public void refreshActiveWork(Map<String, List<KeyedGetDataRequest>>
active) {}
+ public void refreshActiveWork(Map<String, List<KeyedGetDataRequest>>
active) {
+ Windmill.GetDataRequest.Builder builder =
Windmill.GetDataRequest.newBuilder();
+ for (Map.Entry<String, List<KeyedGetDataRequest>> entry :
active.entrySet()) {
+ builder.addRequests(
+ ComputationGetDataRequest.newBuilder()
+ .setComputationId(entry.getKey())
+ .addAllRequests(entry.getValue())
+ .build());
+ Windmill.ComputationGetDataRequest.Builder computationBuilder =
Review Comment:
Done
##########
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorkerTest.java:
##########
@@ -3081,6 +3146,283 @@ public void testActiveWorkRefresh() throws Exception {
assertThat(server.numGetDataRequests(), greaterThan(0));
}
+ static class FakeClock implements Supplier<Instant> {
+ private static final FakeClock DEFAULT = new FakeClock();
+
+ private Instant now = Instant.now();
+
+ @Override
+ public synchronized Instant get() {
+ return now;
+ }
+
+ synchronized void sleep(Duration duration) {
+ this.now = this.now.plus(duration);
+ }
+ }
+
+ @Test
+ public void testLatencyAttributionProtobufsPopulated() throws Exception {
+ StreamingDataflowWorker.Work work =
+ new StreamingDataflowWorker.Work(null, FakeClock.DEFAULT) {
+ @Override
+ public void run() {}
+ };
+
+ FakeClock.DEFAULT.sleep(Duration.millis(10));
+ work.setState(StreamingDataflowWorker.Work.State.PROCESSING);
+ FakeClock.DEFAULT.sleep(Duration.millis(20));
+ work.setState(StreamingDataflowWorker.Work.State.COMMIT_QUEUED);
+ FakeClock.DEFAULT.sleep(Duration.millis(30));
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]