Skip to content

Commit

Permalink
Remove unused closeAlert (#16877)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanwenjun authored Dec 5, 2024
1 parent 84f6a0f commit 271fa23
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 237 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.apache.dolphinscheduler.alert.api;

import lombok.NonNull;

/**
* alert channel for sending alerts
*/
Expand All @@ -32,7 +30,4 @@ public interface AlertChannel {
*/
AlertResult process(AlertInfo info);

default @NonNull AlertResult closeAlert(AlertInfo info) {
return new AlertResult(true, "no need to close alert");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager;
import org.apache.dolphinscheduler.common.enums.AlertStatus;
import org.apache.dolphinscheduler.common.enums.AlertType;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import org.apache.dolphinscheduler.dao.entity.AlertSendStatus;
Expand Down Expand Up @@ -128,19 +127,10 @@ public AlertResult doSendEvent(AlertPluginInstance instance, AlertData alertData
try {
AlertResult alertResult;
if (sendEventTimeout <= 0) {
if (alertData.getAlertType() == AlertType.CLOSE_ALERT.getCode()) {
alertResult = alertChannel.closeAlert(alertInfo);
} else {
alertResult = alertChannel.process(alertInfo);
}
alertResult = alertChannel.process(alertInfo);
} else {
CompletableFuture<AlertResult> future;
if (alertData.getAlertType() == AlertType.CLOSE_ALERT.getCode()) {
future = CompletableFuture.supplyAsync(() -> alertChannel.closeAlert(alertInfo));
} else {
future = CompletableFuture.supplyAsync(() -> alertChannel.process(alertInfo));
}
alertResult = future.get(sendEventTimeout, TimeUnit.MILLISECONDS);
alertResult = CompletableFuture.supplyAsync(() -> alertChannel.process(alertInfo)).get(sendEventTimeout,
TimeUnit.MILLISECONDS);
}
checkNotNull(alertResult, "AlertResult cannot be null");
return alertResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.apache.dolphinscheduler.common.constants;

import org.apache.commons.lang3.SystemUtils;

import java.time.Duration;
import java.util.regex.Pattern;

Expand All @@ -27,8 +25,6 @@
@UtilityClass
public final class Constants {

public static final String AUTO_CLOSE_ALERT = "alert.auto-close";

/**
* common properties path
*/
Expand All @@ -38,7 +34,6 @@ public final class Constants {
public static final String AWS_YAML_PATH = "/aws.yaml";
public static final String RESOURCE_CENTER_YAML_PATH = "/resource-center.yaml";

public static final String FORMAT_SS = "%s%s";
public static final String FORMAT_S_S = "%s/%s";
public static final String FORMAT_S_S_COLON = "%s:%s";
public static final String FOLDER_SEPARATOR = "/";
Expand All @@ -50,17 +45,6 @@ public final class Constants {
*/
public static final String FS_DEFAULT_FS = "resource.hdfs.fs.defaultFS";

/**
* hdfs defaultFS property name. Should be consistent with the property name in hdfs-site.xml
*/
public static final String HDFS_DEFAULT_FS = "fs.defaultFS";

/**
* hdfs configuration
* resource.hdfs.root.user
*/
public static final String HDFS_ROOT_USER = "resource.hdfs.root.user";

/**
* hdfs/s3 configuration
* resource.storage.upload.base.path
Expand All @@ -72,16 +56,6 @@ public final class Constants {
*/
public static final String DATA_BASEDIR_PATH = "data.basedir.path";

/**
* dolphinscheduler.env.path
*/
public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path";

/**
* environment properties default path
*/
public static final String ENV_PATH = "dolphinscheduler_env.sh";

/**
* resource.view.suffixs
*/
Expand All @@ -107,28 +81,6 @@ public final class Constants {

public static final String AWS_S3_BUCKET_NAME = "aws.s3.bucket.name";

public static final String ALIBABA_CLOUD_OSS_BUCKET_NAME = "resource.alibaba.cloud.oss.bucket.name";
public static final String ALIBABA_CLOUD_OSS_END_POINT = "resource.alibaba.cloud.oss.endpoint";

public static final String GOOGLE_CLOUD_STORAGE_BUCKET_NAME = "resource.google.cloud.storage.bucket.name";

public static final String GOOGLE_CLOUD_STORAGE_CREDENTIAL = "resource.google.cloud.storage.credential";

public static final String AZURE_BLOB_STORAGE_CONNECTION_STRING = "resource.azure.blob.storage.connection.string";

public static final String AZURE_BLOB_STORAGE_CONTAINER_NAME = "resource.azure.blob.storage.container.name";

public static final String AZURE_BLOB_STORAGE_ACCOUNT_NAME = "resource.azure.blob.storage.account.name";

public static final String HUAWEI_CLOUD_OBS_BUCKET_NAME = "resource.huawei.cloud.obs.bucket.name";
public static final String HUAWEI_CLOUD_OBS_END_POINT = "resource.huawei.cloud.obs.endpoint";

/**
* fetch applicationId way
*/
public static final String APPID_COLLECT = "appId.collect";
public static final String DEFAULT_COLLECT_WAY = "log";

/**
* comma ,
*/
Expand All @@ -139,16 +91,6 @@ public final class Constants {
*/
public static final String COLON = ":";

/**
* period .
*/
public static final String PERIOD = ".";

/**
* QUESTION ?
*/
public static final String QUESTION = "?";

/**
* SPACE " "
*/
Expand Down Expand Up @@ -253,11 +195,6 @@ public final class Constants {
*/
public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION;

/**
* max task timeout
*/
public static final int MAX_TASK_TIMEOUT = 24 * 3600;

/**
* forbid running task
*/
Expand Down Expand Up @@ -289,11 +226,6 @@ public final class Constants {
*/
public static final long SLEEP_TIME_MILLIS = 1_000L;

/**
* short sleep 100ms
*/
public static final long SLEEP_TIME_MILLIS_SHORT = 100L;

public static final Duration SERVER_CLOSE_WAIT_TIME = Duration.ofSeconds(3);

/**
Expand Down Expand Up @@ -346,24 +278,16 @@ public final class Constants {
*/
public static final String UNDERLINE = "_";

public static final String PID = SystemUtils.IS_OS_WINDOWS ? "handle" : "pid";

public static final String STAR = "*";
public static final char N = 'N';
public static final String GLOBAL_PARAMS = "globalParams";
public static final String LOCAL_PARAMS = "localParams";
public static final String SUBWORKFLOW_INSTANCE_ID = "subWorkflowInstanceId";
public static final String WORKFLOW_INSTANCE_STATE = "workflowInstanceState";
public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance";
public static final String CONDITION_RESULT = "conditionResult";
public static final String SWITCH_RESULT = "switchResult";
public static final String WAIT_START_TIMEOUT = "waitStartTimeout";
public static final String DEPENDENCE = "dependence";
public static final String TASK_LIST = "taskList";
public static final String QUEUE = "queue";
public static final String QUEUE_NAME = "queueName";
public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0;
public static final int LOG_QUERY_LIMIT = 4096;
public static final String DEPENDENT_SPLIT = ":||";
public static final long DEPENDENT_ALL_TASK_CODE = -1;
public static final long DEPENDENT_WORKFLOW_CODE = 0;
Expand All @@ -378,11 +302,6 @@ public final class Constants {
*/
public static final String KERBEROS = "kerberos";

/**
* kerberos expire time
*/
public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time";

/**
* java.security.krb5.conf
*/
Expand Down Expand Up @@ -419,29 +338,8 @@ public final class Constants {
*/
public static final String SSO_LOGIN_USER_STATE = "sso.login.user.state";

public static final String WORKFLOW_INSTANCE_ID_MDC_KEY = "workflowInstanceId";
public static final String TASK_INSTANCE_ID_MDC_KEY = "taskInstanceId";

/**
* double brackets left
*/
public static final String DOUBLE_BRACKETS_LEFT = "{{";

/**
* double brackets left
*/
public static final String DOUBLE_BRACKETS_RIGHT = "}}";

/**
* double brackets left
*/
public static final String DOUBLE_BRACKETS_LEFT_SPACE = "{ {";

/**
* double brackets left
*/
public static final String DOUBLE_BRACKETS_RIGHT_SPACE = "} }";

/**
* status
*/
Expand All @@ -452,11 +350,6 @@ public final class Constants {
*/
public static final String MSG = "msg";

/**
* data total
*/
public static final String COUNT = "count";

/**
* page size
*/
Expand Down Expand Up @@ -501,8 +394,6 @@ public final class Constants {
*/
public static final int SESSION_TIME_OUT = 7200;

public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024;

public static final String CLASS = "class";

/**
Expand All @@ -524,17 +415,6 @@ public final class Constants {
*/
public static final String SH = "sh";

/**
* pstree, get pud and sub pid
*/
public static final String PSTREE = "pstree";

/**
* dry run flag
*/
public static final int DRY_RUN_FLAG_NO = 0;
public static final int DRY_RUN_FLAG_YES = 1;

/**
* use for k8s
*/
Expand All @@ -546,18 +426,12 @@ public final class Constants {
* schedule timezone
*/
public static final String SCHEDULE_TIMEZONE = "schedule_timezone";
public static final int RESOURCE_FULL_NAME_MAX_LENGTH = 128;

/**
* tenant
*/
public static final int TENANT_FULL_NAME_MAX_LENGTH = 30;

/**
* schedule time the amount of date data is too large, affecting the memory, so set 100
*/
public static final int SCHEDULE_TIME_MAX_LENGTH = 100;

/**
* password max and min LENGTH
*/
Expand All @@ -578,12 +452,6 @@ public final class Constants {

public static final String SECURITY_CONFIG_TYPE_LDAP = "LDAP";

/**
* test flag
*/
public static final int TEST_FLAG_NO = 0;
public static final int TEST_FLAG_YES = 1;

/**
* Task Types
*/
Expand Down Expand Up @@ -625,15 +493,6 @@ public final class Constants {
/** string no */
public static final String STRING_NO = "NO";

public static final String SMALL = "small";

public static final String CHANGE = "change";

/**
* support hive datasource in one session
*/
public static final String SUPPORT_HIVE_ONE_SESSION = "support.hive.oneSession";

public static final Integer QUERY_ALL_ON_SYSTEM = 0;
public static final Integer QUERY_ALL_ON_PROJECT = 1;
public static final Integer QUERY_ALL_ON_WORKFLOW = 2;
Expand All @@ -658,8 +517,6 @@ public final class Constants {

public static final String REMOTE_LOGGING_OSS_ENDPOINT = "remote.logging.oss.endpoint";

public static final String REMOTE_LOGGING_S3_BUCKET_NAME = "remote.logging.s3.bucket.name";

/**
* remote logging for GCS
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public enum AlertType {
TASK_FAILURE(5, "task failure"),
TASK_SUCCESS(6, "task success"),
TASK_TIMEOUT(7, "task timeout"),

CLOSE_ALERT(8, "the workflow instance success, can close the before alert");
;

AlertType(int code, String descp) {
this.code = code;
Expand Down

This file was deleted.

Loading

0 comments on commit 271fa23

Please sign in to comment.