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_r352923144
##########
File path:
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerManager.java
##########
@@ -161,4 +262,140 @@ void handleExpiredRequestWithHostAffinityEnabled(String
processorId, String pref
allocator.requestResource(processorId, ResourceRequestState.ANY_HOST);
}
}
+
+ /**
+ * Registers a container placement action to move the running container to
destination host, if destination host is same as the
+ * host on which container is running, container placement action is treated
as a restart.
+ *
+ * When host affinity is disabled a move / restart is only allowed on
ANY_HOST
+ * When host affinity is enabled move / restart is allowed on specific or
ANY_HOST
+ * TODO: SAMZA-2378: Container Placements for Standby containers enabled jobs
+ *
+ * @param requestMessage request containing logical processor id 0,1,2 and
host where container is desired to be moved,
+ * acceptable values of this param are any valid
hostname or "ANY_HOST"(in this case the request
+ * is sent to resource manager for any host)
+ * @param containerAllocator to request physical resources
+ */
+ public void
registerContainerPlacementAction(ContainerPlacementRequestMessage
requestMessage, ContainerAllocator containerAllocator) {
+ LOG.info("Received ControlAction request to move or restart container with
processor id {} to host {}",
+ requestMessage.getProcessorId(), requestMessage.getDestinationHost());
+ String processorId = requestMessage.getProcessorId();
+ String destinationHost = requestMessage.getDestinationHost();
+ Pair<ContainerPlacementMessage.StatusCode, String> actionStatus =
+ checkValidControlAction(processorId, destinationHost,
requestMessage.getUuid());
Review comment:
Once #1227 is merged, this method will create a response message with
actionStatus.getValue & dispatch it via
ContainerPlacementHandler#writeContainerPlacementResponseMessage in the if below
----------------------------------------------------------------
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