wangbo commented on code in PR #28443:
URL: https://github.com/apache/doris/pull/28443#discussion_r1427632105


##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadSchedPolicy.java:
##########
@@ -0,0 +1,188 @@
+// 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.doris.resource.workloadschedpolicy;
+
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+import org.apache.doris.persist.gson.GsonPostProcessable;
+import org.apache.doris.persist.gson.GsonUtils;
+
+import com.esotericsoftware.minlog.Log;
+import com.google.common.collect.ImmutableSet;
+import com.google.gson.annotations.SerializedName;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class WorkloadSchedPolicy implements Writable, GsonPostProcessable {
+
+    public static final String ENABLED = "enabled";
+    public static final String PRIORITY = "priority";
+    public static final ImmutableSet<String> POLICY_PROPERTIES = new 
ImmutableSet.Builder<String>()
+            .add(ENABLED).add(PRIORITY).build();
+
+    @SerializedName(value = "id")
+    long id;
+    @SerializedName(value = "name")
+    String name;
+    @SerializedName(value = "version")
+    int version;
+
+    @SerializedName(value = "enabled")
+    private volatile boolean enabled;
+    @SerializedName(value = "priority")
+    private volatile int priority;
+
+    @SerializedName(value = "conditionMetaList")
+    List<ConditionMeta> conditionMetaList;
+    // we regard action as a command, map's key is command, map's value is 
args, so it's a command list
+    @SerializedName(value = "actionMetaList")
+    Map<String, String> actionMetaList;
+
+    private List<PolicyCondition> policyConditionList;
+    private List<PolicyAction> policyActionList;
+
+    public WorkloadSchedPolicy(long id, String name, List<PolicyCondition> 
policyConditionList,
+            List<PolicyAction> policyActionList, Map<String, String> 
properties) throws UserException {
+        this.id = id;
+        this.name = name;
+        this.policyConditionList = policyConditionList;
+        this.policyActionList = policyActionList;
+        // set enable and priority
+        parseAndSetProperties(properties);
+        this.version = 0;
+    }
+
+    // return true, this means all conditions in policy can match queryInfo's 
data
+    // return false,
+    //    1 metric not match
+    //    2 condition value not match query info's value
+    boolean isMatch(PolicyQueryInfo queryInfo) {

Review Comment:
   
policy本身是分fe和be的,所以你说的这个我感觉应该是在定时线程调用里区分比较好。比如fe的定时线程就只取fe的policy。目前由于缺乏统一的统计信息收集渠道,所以暂不支持混合型的policy,这个得很靠后了。后续再改就行。



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