yiguolei commented on code in PR #29116:
URL: https://github.com/apache/doris/pull/29116#discussion_r1436713650


##########
be/src/runtime/workload_management/workload_action.h:
##########
@@ -0,0 +1,69 @@
+// 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.
+
+#pragma once
+
+#include "runtime/workload_management/workload_query_info.h"
+
+namespace doris {
+
+enum WorkloadActionType { MOVE_QUERY_TO_GROUP = 0, CANCEL_QUERY = 1 };
+
+class WorkloadAction {
+public:
+    WorkloadAction() = default;
+    virtual ~WorkloadAction() = default;
+
+    virtual void exec(WorkloadQueryInfo* query_info) = 0;
+
+    virtual WorkloadActionType get_action_type() = 0;
+};
+
+class WorkloadActionCancelQuery : public WorkloadAction {
+public:
+    void exec(WorkloadQueryInfo* query_info) override;
+
+    WorkloadActionType get_action_type() override { return CANCEL_QUERY; }
+};
+
+//todo(wb) implement it
+class WorkloadActionMoveQuery : public WorkloadAction {
+public:
+    WorkloadActionMoveQuery(std::string wg_name) : _wg_name(wg_name) {}
+    void exec(WorkloadQueryInfo* query_info) override {};
+
+    WorkloadActionType get_action_type() override { return 
MOVE_QUERY_TO_GROUP; }
+
+private:
+    std::string _wg_name;
+};
+
+class WorkloadActionFactory {
+public:
+    static std::unique_ptr<WorkloadAction> create_workload_action(std::string 
action,
+                                                                  std::string 
action_args) {
+        if ("MOVE_QUERY_TO_GROUP" == action) {

Review Comment:
   不要依赖name, 在thrift 中定义一个workload action的enum 类型。FE 中已经有一段这种解析的代码了,BE 
上就不要自己再解析了。
   string 的值,经常被别人不小心改掉。



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to