jerrypeng commented on a change in pull request #2748: Fix getstatus logic in 
kubernetes runtime
URL: https://github.com/apache/pulsar/pull/2748#discussion_r223531707
 
 

 ##########
 File path: 
pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java
 ##########
 @@ -491,7 +491,24 @@ private void stopFunction(String 
fullyQualifiedInstanceId, boolean restart) thro
                     
functionStatusListBuilder.addFunctionStatusList(functionStatus);
                 }
             } else {
-                return 
this.functionAdmin.functions().getFunctionStatus(tenant, namespace, 
functionName);
+                // find the hostname/port of the worker who is the owner
+
+                List<WorkerInfo> workerInfoList = 
this.membershipManager.getCurrentMembership();
+                WorkerInfo workerInfo = null;
+                for (WorkerInfo entry: workerInfoList) {
+                    if (assignment.getWorkerId().equals(entry.getWorkerId())) {
+                        workerInfo = entry;
+                    }
+                }
+                if (workerInfo == null) {
+                    InstanceCommunication.FunctionStatusList.Builder 
functionStatusBuilder
+                            = 
InstanceCommunication.FunctionStatusList.newBuilder();
+                    functionStatusBuilder.setError("Function not yet 
scheduled");
 
 Review comment:
   it should't be an internal server error.  I think it should be a 503 
"service not available"

----------------------------------------------------------------
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


With regards,
Apache Git Services

Reply via email to