Sanil15 commented on a change in pull request #1180: Samza-2340 Introduce 
ContainerManager for handling validation for failures & starts of active & 
standby containers
URL: https://github.com/apache/samza/pull/1180#discussion_r334625056
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerManager.java
 ##########
 @@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.samza.clustermanager;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.time.Duration;
+import java.util.Optional;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * ContainerManager is a centralized entity that manages control actions like 
start, stop for both active and standby containers
+ * ContainerManager acts as a brain for validating and issuing any actions on 
containers in the Job Coordinator.
+ *
+ * The requests to allocate resources resources made by {@link 
ContainerAllocator} can either expire or succeed.
+ * When the requests succeeds the ContainerManager validates those requests 
before starting the container
+ * When the requests expires the ContainerManager decides the next set of 
actions for the pending request.
+ *
+ * Callbacks issued from  {@link ClusterResourceManager} aka {@link 
ContainerProcessManager} are intercepted
+ * by ContainerManager to handle container failure and completions for both 
active and standby containers
+ */
+public class ContainerManager {
 
 Review comment:
   I tried it before 
(https://github.com/apache/samza/compare/master...Sanil15:container-placement) 
but I did not see any value in adding a new contract because if we add this 
interface 
   
   ```
   public interface Actions {
     void handleContainerStop();
     void handleContainerLaunchFail();
     void handleContainerLaunchSuccess();
     void handleContainerExpiredRequests();
   }
   ```
   Then we would have this 
   
   ActiveContainerManager implements ContainerManager {...}
   StandByContainerManager implements ContainerManager {...}
   
   We would need a composition between ActiveContainerManager and 
StandByContainerManager. ContainerProcessManager and ContainerAllocator will 
also compose ActiveContainerManager, at that time if they compose this new 
interface ContainerManager vs a concrete class ActiveContainerManager does it 
matter? 
   
   Perhaps it would have made sense to add this if we had Multilevel 
Inheritance between these classes:
   
   Container Manager <----- ActiveContainerManager <====  
StandByContainerManager
   

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