Sanil15 commented on a change in pull request #1219: SAMZA-2373: Container 
Placement Service (core functionality) for container move and restart
URL: https://github.com/apache/samza/pull/1219#discussion_r365467480
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerManager.java
 ##########
 @@ -62,33 +83,67 @@ public ContainerManager(SamzaApplicationState 
samzaApplicationState, ClusterReso
   }
 
   /**
-   * Handles the container start action for both active & standby containers.
+   * Handles the container start action for both active & standby containers. 
This method is invoked by the allocator thread
+   *
+   * Case 1. If the container launch request is due to an existing container 
placement action, issue a stop on active
+   *         container & wait for the active container to be stopped before 
issuing a start.
+   * Case 2. If StandbyContainer is present refer to {@code 
StandbyContainerManager#checkStandbyConstraintsAndRunStreamProcessor}
+   * Case 3. Otherwise just invoke a container start on the allocated resource 
for the pending request
+   *
+   * TODO: SAMZA-2399: Investigate & configure a timeout for container stop if 
needed
    *
    * @param request pending request for the preferred host
    * @param preferredHost preferred host to start the container
    * @param allocatedResource resource allocated from {@link 
ClusterResourceManager}
    * @param resourceRequestState state of request in {@link ContainerAllocator}
    * @param allocator to request resources from @{@link ClusterResourceManager}
+   *
+   * @return true if the container launch is complete, false if the container 
launch is in progress. A container launch
+   *         might be in progress when it is waiting for the previous 
container incarnation to stop in case of container
+   *         placement actions
    */
-  void handleContainerLaunch(SamzaResourceRequest request, String 
preferredHost, SamzaResource allocatedResource,
+  boolean handleContainerLaunch(SamzaResourceRequest request, String 
preferredHost, SamzaResource allocatedResource,
       ResourceRequestState resourceRequestState, ContainerAllocator allocator) 
{
+    LOG.info("Found an available container for Processor ID: {} on the host: 
{}", request.getProcessorId(), preferredHost);
+    if (hasActiveContainerPlacementAction(request.getProcessorId())) {
+      String processorId = request.getProcessorId();
+      ContainerPlacementMetadata actionMetaData = 
getPlacementActionMetadata(processorId).get();
+      ContainerPlacementMetadata.ContainerStatus actionStatus = 
actionMetaData.getContainerStatus();
 
 Review comment:
   because of && in the first if I cannot use it for all three cases, maybe for 
the other two if its worth it?

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