xintongsong commented on code in PR #21233:
URL: https://github.com/apache/flink/pull/21233#discussion_r1036726634
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManager.java:
##########
@@ -299,6 +295,29 @@ public void onError(Throwable exception) {
// Internal
// ------------------------------------------------------------------------
+ /**
+ * Allocates a resource using the worker resource specification.
+ *
+ * @param workerResourceSpec workerResourceSpec specifies the size of the
to be allocated
+ * resource
+ * @return whether the resource can be allocated
+ */
+ @VisibleForTesting
+ public boolean startNewWorker(WorkerResourceSpec workerResourceSpec) {
+ requestNewWorker(workerResourceSpec);
+ return true;
+ }
Review Comment:
It seems we no longer need this boolean return value.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java:
##########
@@ -1262,16 +1252,6 @@ protected abstract void internalDeregisterApplication(
ApplicationStatus finalStatus, @Nullable String
optionalDiagnostics)
throws ResourceManagerException;
- /**
- * Allocates a resource using the worker resource specification.
- *
- * @param workerResourceSpec workerResourceSpec specifies the size of the
to be allocated
- * resource
- * @return whether the resource can be allocated
- */
- @VisibleForTesting
- public abstract boolean startNewWorker(WorkerResourceSpec
workerResourceSpec);
Review Comment:
Shall we also move `stopWorker` to `ActiveResourceManager`?
`StandaloneResourceManager#stopWorker` does nothing.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/NonSupportedResourceAllocatorImpl.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.runtime.instance.InstanceID;
+import org.apache.flink.runtime.resourcemanager.WorkerResourceSpec;
+
+/** ResourceAllocator that not support to allocate/release resources. */
+public class NonSupportedResourceAllocatorImpl implements ResourceAllocator {
Review Comment:
This can be singleton.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/ResourceAllocator.java:
##########
@@ -18,15 +18,13 @@
package org.apache.flink.runtime.resourcemanager.slotmanager;
-import org.apache.flink.api.common.JobID;
import org.apache.flink.runtime.instance.InstanceID;
import org.apache.flink.runtime.resourcemanager.WorkerResourceSpec;
-import org.apache.flink.runtime.slots.ResourceRequirement;
-
-import java.util.Collection;
/** Resource related actions which the {@link SlotManager} can perform. */
-public interface ResourceActions {
+public interface ResourceAllocator {
+
+ boolean isSupported();
Review Comment:
JavaDoc is missing.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java:
##########
@@ -1262,16 +1252,6 @@ protected abstract void internalDeregisterApplication(
ApplicationStatus finalStatus, @Nullable String
optionalDiagnostics)
throws ResourceManagerException;
- /**
- * Allocates a resource using the worker resource specification.
- *
- * @param workerResourceSpec workerResourceSpec specifies the size of the
to be allocated
- * resource
- * @return whether the resource can be allocated
- */
- @VisibleForTesting
- public abstract boolean startNewWorker(WorkerResourceSpec
workerResourceSpec);
Review Comment:
And maybe `workerStarted` as well. The method is used for deciding whether
to accept a TM registration. For active clusters we accept only the resources
that we actively requested, while for standalone clusters we always accept.
--
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]