RocMarshal commented on code in PR #25174: URL: https://github.com/apache/flink/pull/25174#discussion_r1797643971
########## flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/loading/LoadingWeight.java: ########## @@ -0,0 +1,43 @@ +/* + * 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.scheduler.loading; + +import org.apache.flink.annotation.Internal; + +import java.io.Serializable; + +/** The class is used to represent the loading weight abstraction. */ +@Internal +public interface LoadingWeight extends Comparable<LoadingWeight>, Serializable { Review Comment: yeah, in TasksBalancedRequestSlotMatchingStrategy. I tried to accelerate the matching by sorting. ########## flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/loading/LoadingWeight.java: ########## @@ -0,0 +1,43 @@ +/* + * 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.scheduler.loading; Review Comment: My original intention is that the abstraction related is belonging to the category of scheduling. Do you have any ideas about it ? thanks~ ########## flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/SlotInfo.java: ########## @@ -54,10 +59,27 @@ public interface SlotInfo { */ ResourceProfile getResourceProfile(); + /** + * Set the loading. + * + * @param loadingWeight loading weight to set. + */ + void setLoading(LoadingWeight loadingWeight); + + /** Reset the loading. */ + void resetLoading(); + /** * Returns whether the slot will be occupied indefinitely. * * @return true if the slot will be occupied indefinitely, otherwise false. */ boolean willBeOccupiedIndefinitely(); + + /** + * Return the previous {@link LoadableResourceProfile} of the current slot. + * + * @return The previous loadable resource profile of the current slot. + */ + Optional<LoadableResourceProfile> getPreviousLoadableResourceProfile(); Review Comment: Just for extracting trivial lines as a method, which is convenient to call in the related points in the previous implementation -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
