zentol commented on a change in pull request #13464: URL: https://github.com/apache/flink/pull/13464#discussion_r499370304
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DefaultResourceTracker.java ########## @@ -0,0 +1,126 @@ +/* + * 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.runtime.resourcemanager.slotmanager; + +import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.api.common.JobID; +import org.apache.flink.runtime.clusterframework.types.ResourceProfile; +import org.apache.flink.runtime.slots.ResourceRequirement; +import org.apache.flink.util.Preconditions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Default {@link ResourceTracker} implementation. + */ +public class DefaultResourceTracker implements ResourceTracker { + + private static final Logger LOG = LoggerFactory.getLogger(DefaultResourceTracker.class); + + private final Map<JobID, JobScopedResourceTracker> trackers = new LinkedHashMap<>(); Review comment: It only ensures that that the Map returned by `getRequiredResources` orders jobs in a FIFO manner. It is technically not necessary, as it could be argued that the FIFO behavior is a more high-level concern of the ResourceManager/SlotManager. But it simplifies things a bit if you can just iterate over the map, instead if having to iterate over _some other_ LinkedHashMap in the slot manager and do a look up for the required resources. ---------------------------------------------------------------- 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]
