[ 
https://issues.apache.org/jira/browse/BEAM-5262?focusedWorklogId=143205&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-143205
 ]

ASF GitHub Bot logged work on BEAM-5262:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Sep/18 17:31
            Start Date: 11/Sep/18 17:31
    Worklog Time Spent: 10m 
      Work Description: youngoli commented on a change in pull request #6301: 
[BEAM-5262] Add Reference runner support for add state stream
URL: https://github.com/apache/beam/pull/6301#discussion_r216754306
 
 

 ##########
 File path: 
runners/direct-java/src/main/java/org/apache/beam/runners/direct/portable/job/ReferenceRunnerJobService.java
 ##########
 @@ -201,6 +204,36 @@ public void getState(
     responseObserver.onCompleted();
   }
 
+  @Override
+  public void getStateStream(
+      GetJobStateRequest request, StreamObserver<GetJobStateResponse> 
responseObserver) {
+    LOG.trace("{} {}", GetJobStateRequest.class.getSimpleName(), request);
+    String invocationId = request.getJobId();
+    try {
+      Thread.sleep(WAIT_MS);
+      Enum state = jobStates.getOrDefault(request.getJobId(), 
Enum.UNRECOGNIZED);
+      
responseObserver.onNext(GetJobStateResponse.newBuilder().setState(state).build());
+      while (Enum.RUNNING.equals(state)) {
+        Thread.sleep(WAIT_MS);
+        state = jobStates.getOrDefault(request.getJobId(), Enum.UNRECOGNIZED);
+      }
+      
responseObserver.onNext(GetJobStateResponse.newBuilder().setState(state).build());
 
 Review comment:
   Makes sense. And it seems that in the case of it not being in the running 
state, it's not an issue to republish the state, so there's no 
performance/correctness issues here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 143205)
    Time Spent: 1h  (was: 50m)

> JobState support for Reference Runner
> -------------------------------------
>
>                 Key: BEAM-5262
>                 URL: https://issues.apache.org/jira/browse/BEAM-5262
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-direct
>            Reporter: Ankur Goenka
>            Assignee: Ankur Goenka
>            Priority: Minor
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Reference runner does not support getStateStream which is needed by portable 
> SDK



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to