[03/74] [abbrv] hadoop git commit: YARN-7050. Post cleanup after YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java deleted file mode 100644 index 9c5708f..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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.slider.server.appmaster.model.mock; - -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.Container; -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.NodeReport; -import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.client.api.AMRMClient; -import org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest; -import org.apache.slider.server.appmaster.operations.AbstractRMOperation; -import org.apache.slider.server.appmaster.operations.CancelSingleRequest; -import org.apache.slider.server.appmaster.operations.ContainerReleaseOperation; -import org.apache.slider.server.appmaster.operations.ContainerRequestOperation; -import org.junit.Assert; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertNotNull; - -/** - * This is an evolving engine to mock YARN operations. - */ -public class MockYarnEngine { - private static final Logger LOG = - LoggerFactory.getLogger(MockYarnEngine.class); - - private MockYarnCluster cluster; - private Allocator allocator; - private List pending = new ArrayList<>(); - - private ApplicationId appId = new MockApplicationId(0, 0); - - private ApplicationAttemptId attemptId = new MockApplicationAttemptId(appId, - 1); - - @Override - public String toString() { -return "MockYarnEngine " + cluster + " + pending=" + pending.size(); - } - - public int containerCount() { -return cluster.containersInUse(); - } - - public MockYarnEngine(int clusterSize, int containersPerNode) { -cluster = new MockYarnCluster(clusterSize, containersPerNode); -allocator = new Allocator(cluster); - } - - public MockYarnCluster getCluster() { -return cluster; - } - - public Allocator getAllocator() { -return allocator; - } - - /** - * Allocate a container from a request. The containerID will be - * unique, nodeId and other fields chosen internally with - * no such guarantees; resource and priority copied over - * @param request request - * @return container - */ - public Container allocateContainer(AMRMClient.ContainerRequest request) { -MockContainer allocated = allocator.allocate(request); -if (allocated != null) { - MockContainerId id = (MockContainerId)allocated.getId(); - id.setApplicationAttemptId(attemptId); -} -return allocated; - } - - MockYarnCluster.MockYarnClusterContainer releaseContainer(ContainerId - containerId) { -return cluster.release(containerId); - } - - /** - * Process a list of operations -release containers to be released, - * allocate those for which there is space (but don't rescan the list after - * the scan). - * @param ops - * @return - */ - public List execute(List ops) { -return execute(ops, new ArrayList<>()); - } - - /** - * Process a list of operations -release containers to be released, - * allocate those for which there is space (but don't rescan the list after - * the scan). Unsatisifed entries a
[03/74] [abbrv] hadoop git commit: YARN-7050. Post cleanup after YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/43277ffd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java deleted file mode 100644 index 9c5708f..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/test/java/org/apache/slider/server/appmaster/model/mock/MockYarnEngine.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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.slider.server.appmaster.model.mock; - -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.Container; -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.NodeReport; -import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.client.api.AMRMClient; -import org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest; -import org.apache.slider.server.appmaster.operations.AbstractRMOperation; -import org.apache.slider.server.appmaster.operations.CancelSingleRequest; -import org.apache.slider.server.appmaster.operations.ContainerReleaseOperation; -import org.apache.slider.server.appmaster.operations.ContainerRequestOperation; -import org.junit.Assert; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertNotNull; - -/** - * This is an evolving engine to mock YARN operations. - */ -public class MockYarnEngine { - private static final Logger LOG = - LoggerFactory.getLogger(MockYarnEngine.class); - - private MockYarnCluster cluster; - private Allocator allocator; - private List pending = new ArrayList<>(); - - private ApplicationId appId = new MockApplicationId(0, 0); - - private ApplicationAttemptId attemptId = new MockApplicationAttemptId(appId, - 1); - - @Override - public String toString() { -return "MockYarnEngine " + cluster + " + pending=" + pending.size(); - } - - public int containerCount() { -return cluster.containersInUse(); - } - - public MockYarnEngine(int clusterSize, int containersPerNode) { -cluster = new MockYarnCluster(clusterSize, containersPerNode); -allocator = new Allocator(cluster); - } - - public MockYarnCluster getCluster() { -return cluster; - } - - public Allocator getAllocator() { -return allocator; - } - - /** - * Allocate a container from a request. The containerID will be - * unique, nodeId and other fields chosen internally with - * no such guarantees; resource and priority copied over - * @param request request - * @return container - */ - public Container allocateContainer(AMRMClient.ContainerRequest request) { -MockContainer allocated = allocator.allocate(request); -if (allocated != null) { - MockContainerId id = (MockContainerId)allocated.getId(); - id.setApplicationAttemptId(attemptId); -} -return allocated; - } - - MockYarnCluster.MockYarnClusterContainer releaseContainer(ContainerId - containerId) { -return cluster.release(containerId); - } - - /** - * Process a list of operations -release containers to be released, - * allocate those for which there is space (but don't rescan the list after - * the scan). - * @param ops - * @return - */ - public List execute(List ops) { -return execute(ops, new ArrayList<>()); - } - - /** - * Process a list of operations -release containers to be released, - * allocate those for which there is space (but don't rescan the list after - * the scan). Unsatisifed entries a