rmatharu 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_r387923398
##########
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:
CPM does a similar thing at
```
String lastSeenOn =
state.jobModelManager.jobModel().getContainerToHostValue(processorId,
SetContainerHostMapping.HOST_KEY);
```
Is it possible to consolidate these multiple job-model-manager accesses?
maybe call it just getHostForContainer?
----------------------------------------------------------------
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