Sanil15 commented on a change in pull request #1297: SAMZA-2379: Support 
Container Placements for job running in degraded state 
URL: https://github.com/apache/samza/pull/1297#discussion_r388601777
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerManager.java
 ##########
 @@ -429,6 +429,25 @@ private void 
writeContainerPlacementResponseMessage(ContainerPlacementRequestMes
             responseMessage, System.currentTimeMillis()));
   }
 
+  /**
+   * Gets the hostname on which container is either currently running or was 
last seen on if it is not running
+   */
+  private String getSourceHostForContainer(ContainerPlacementRequestMessage 
requestMessage) {
+    String sourceHost = null;
+    String processorId = requestMessage.getProcessorId();
+    if (samzaApplicationState.runningProcessors.containsKey(processorId)) {
+      SamzaResource currentResource = 
samzaApplicationState.runningProcessors.get(processorId);
+      LOG.info("Processor ID: {} matched a running container with containerId 
ID: {} is running on host: {} for ContainerPlacement action: {}",
+          processorId, currentResource.getContainerId(), 
currentResource.getHost(), requestMessage);
+      sourceHost = currentResource.getHost();
+    } else {
+      sourceHost = 
samzaApplicationState.jobModelManager.jobModel().getContainerToHostValue(processorId,
 SetContainerHostMapping.HOST_KEY);
+      LOG.info("Processor ID: {} is not running and was last seen on host: {} 
for ContainerPlacement action: {}",
+          processorId, sourceHost, requestMessage);
 
 Review comment:
   Yes it is possible, one last part left in CPM refactor is moving 
onResourcesCompleted logic to container manager, let's do this as a part of 
that logic

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