xinyuiscool commented on a change in pull request #1197: SAMZA-2067: Support 
Samza's running on Kubernetes
URL: https://github.com/apache/samza/pull/1197#discussion_r344420508
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerProcessManager.java
 ##########
 @@ -184,23 +186,38 @@ public ContainerProcessManager(Config config, 
SamzaApplicationState state, Metri
 
     this.clusterResourceManager = resourceManager;
     this.standbyContainerManager = Optional.empty();
+
     this.diagnosticsManager = Option.empty();
     this.containerAllocator = allocator.orElseGet(
         () -> new ContainerAllocator(this.clusterResourceManager, 
clusterManagerConfig, state,
             hostAffinityEnabled, this.standbyContainerManager));
-    this.allocatorThread = new Thread(this.containerAllocator, "Container 
Allocator Thread");
+    if (shouldStartAllocateThread()) {
+      this.allocatorThread = new Thread(this.containerAllocator, "Container 
Allocator Thread");
+    }
     LOG.info("Finished container process manager initialization");
   }
 
+  // In Kubernetes, the pod will be started by kubelet automatically once it 
is allocated, it does not need a
+  // separate thread to keep polling the allocated resources to start the 
container.
+  public boolean shouldStartAllocateThread() {
+    return 
!clusterResourceManager.getClass().getSimpleName().equals("KubeClusterResourceManager");
 
 Review comment:
   This lookup of specific cluster manager seems pretty hard to maintain. Can 
we think of a better to distinguish when we need this to do container 
allocation?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to