|
|
|
@ -26,11 +26,9 @@ import org.apache.dolphinscheduler.dao.entity.Alert;
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.DqExecuteResult; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.DqExecuteResultAlertContent; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessAlertContent; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProjectUser; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskAlertContent; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskDefinition; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskInstance; |
|
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DqTaskState; |
|
|
|
|
|
|
|
|
@ -108,7 +106,7 @@ public class ProcessAlertManager {
|
|
|
|
|
if (processInstance.getState().typeIsSuccess()) { |
|
|
|
|
List<ProcessAlertContent> successTaskList = new ArrayList<>(1); |
|
|
|
|
ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder() |
|
|
|
|
.projectId(projectUser.getProjectId()) |
|
|
|
|
.projectCode(projectUser.getProjectCode()) |
|
|
|
|
.projectName(projectUser.getProjectName()) |
|
|
|
|
.owner(projectUser.getUserName()) |
|
|
|
|
.processId(processInstance.getId()) |
|
|
|
@ -132,7 +130,7 @@ public class ProcessAlertManager {
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder() |
|
|
|
|
.projectId(projectUser.getProjectId()) |
|
|
|
|
.projectCode(projectUser.getProjectCode()) |
|
|
|
|
.projectName(projectUser.getProjectName()) |
|
|
|
|
.owner(projectUser.getUserName()) |
|
|
|
|
.processId(processInstance.getId()) |
|
|
|
@ -225,7 +223,7 @@ public class ProcessAlertManager {
|
|
|
|
|
String success = processInstance.getState().typeIsSuccess() ? "success" : "failed"; |
|
|
|
|
alert.setTitle(cmdName + " " + success); |
|
|
|
|
alert.setWarningType(processInstance.getState().typeIsSuccess() ? WarningType.SUCCESS : WarningType.FAILURE); |
|
|
|
|
String content = getContentProcessInstance(processInstance, taskInstances,projectUser); |
|
|
|
|
String content = getContentProcessInstance(processInstance, taskInstances, projectUser); |
|
|
|
|
alert.setContent(content); |
|
|
|
|
alert.setAlertGroupId(processInstance.getWarningGroupId()); |
|
|
|
|
alert.setCreateTime(new Date()); |
|
|
|
@ -270,10 +268,10 @@ public class ProcessAlertManager {
|
|
|
|
|
* send process timeout alert |
|
|
|
|
* |
|
|
|
|
* @param processInstance process instance |
|
|
|
|
* @param processDefinition process definition |
|
|
|
|
* @param projectUser projectUser |
|
|
|
|
*/ |
|
|
|
|
public void sendProcessTimeoutAlert(ProcessInstance processInstance, ProcessDefinition processDefinition) { |
|
|
|
|
alertDao.sendProcessTimeoutAlert(processInstance, processDefinition); |
|
|
|
|
public void sendProcessTimeoutAlert(ProcessInstance processInstance, ProjectUser projectUser) { |
|
|
|
|
alertDao.sendProcessTimeoutAlert(processInstance, projectUser); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -359,8 +357,8 @@ public class ProcessAlertManager {
|
|
|
|
|
return JSONUtils.toJsonString(content); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void sendTaskTimeoutAlert(ProcessInstance processInstance, TaskInstance taskInstance, TaskDefinition taskDefinition) { |
|
|
|
|
alertDao.sendTaskTimeoutAlert(processInstance, taskInstance, taskDefinition); |
|
|
|
|
public void sendTaskTimeoutAlert(ProcessInstance processInstance, TaskInstance taskInstance, ProjectUser projectUser) { |
|
|
|
|
alertDao.sendTaskTimeoutAlert(processInstance, taskInstance, projectUser); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -376,7 +374,7 @@ public class ProcessAlertManager {
|
|
|
|
|
String cmdName = getCommandCnName(processInstance.getCommandType()); |
|
|
|
|
List<ProcessAlertContent> blockingNodeList = new ArrayList<>(1); |
|
|
|
|
ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder() |
|
|
|
|
.projectId(projectUser.getProjectId()) |
|
|
|
|
.projectCode(projectUser.getProjectCode()) |
|
|
|
|
.projectName(projectUser.getProjectName()) |
|
|
|
|
.owner(projectUser.getUserName()) |
|
|
|
|
.processId(processInstance.getId()) |
|
|
|
|