tillrohrmann commented on a change in pull request #11353: [FLINK-16438][yarn] 
Make YarnResourceManager starts workers using WorkerResourceSpec requested by 
SlotManager
URL: https://github.com/apache/flink/pull/11353#discussion_r409583691
 
 

 ##########
 File path: 
flink-yarn/src/main/java/org/apache/flink/yarn/WorkerSpecContainerResourceAdapter.java
 ##########
 @@ -0,0 +1,156 @@
+/*
+ * 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.flink.yarn;
+
+import org.apache.flink.annotation.VisibleForTesting;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.runtime.clusterframework.TaskExecutorProcessSpec;
+import org.apache.flink.runtime.clusterframework.TaskExecutorProcessUtils;
+import org.apache.flink.runtime.resourcemanager.WorkerResourceSpec;
+import org.apache.flink.util.Preconditions;
+
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Utility class for converting between Flink {@link WorkerResourceSpec} and 
Yarn {@link Resource}.
+ */
+public class WorkerSpecContainerResourceAdapter {
+       private final Logger log = 
LoggerFactory.getLogger(WorkerSpecContainerResourceAdapter.class);
+
+       private final Configuration flinkConfig;
+       private final int minMemMB;
+       private final int minVcore;
+       private final int maxMemMB;
+       private final int maxVcore;
+       private final WorkerSpecContainerResourceAdapter.MatchingStrategy 
matchingStrategy;
+       private final Map<WorkerResourceSpec, Resource> 
workerSpecToContainerResource;
+       private final Map<Resource, List<WorkerResourceSpec>> 
containerResourceToWorkerSpecs;
+       private final Map<Integer, Set<Resource>> 
containerMemoryToContainerResource;
+
+       @VisibleForTesting
 
 Review comment:
   I think we don't need the `@VisibleForTesting` annotations in this class 
because we did not increase the visibility of these methods for testing 
purposes.

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