use of com.linkedin.thirdeye.anomaly.alert.AlertTaskInfo in project pinot by linkedin.
the class AlertTaskRunnerV2 method execute.
@Override
public List<TaskResult> execute(TaskInfo taskInfo, TaskContext taskContext) throws Exception {
List<TaskResult> taskResult = new ArrayList<>();
AlertTaskInfo alertTaskInfo = (AlertTaskInfo) taskInfo;
alertConfig = alertTaskInfo.getAlertConfigDTO();
thirdeyeConfig = taskContext.getThirdEyeAnomalyConfiguration();
alertFilterFactory = new AlertFilterFactory(thirdeyeConfig.getAlertFilterConfigPath());
try {
LOG.info("Begin executing task {}", taskInfo);
runTask();
} catch (Exception t) {
LOG.error("Task failed with exception:", t);
sendFailureEmail(t);
// Let task driver mark this task failed
throw t;
}
return taskResult;
}
use of com.linkedin.thirdeye.anomaly.alert.AlertTaskInfo in project pinot by linkedin.
the class TaskGenerator method createAlertTasksV2.
public List<AlertTaskInfo> createAlertTasksV2(AlertJobContext alertJobContext, DateTime monitoringWindowStartTime, DateTime monitoringWindowEndTime) throws Exception {
List<AlertTaskInfo> tasks = new ArrayList<>();
AlertConfigDTO alertConfig = alertJobContext.getAlertConfigDTO();
long jobExecutionId = alertJobContext.getJobExecutionId();
AlertTaskInfo taskInfo = new AlertTaskInfo(jobExecutionId, monitoringWindowStartTime, monitoringWindowEndTime, null, alertConfig);
tasks.add(taskInfo);
return tasks;
}
use of com.linkedin.thirdeye.anomaly.alert.AlertTaskInfo in project pinot by linkedin.
the class TaskGenerator method createAlertTasks.
public List<AlertTaskInfo> createAlertTasks(AlertJobContext alertJobContext, DateTime monitoringWindowStartTime, DateTime monitoringWindowEndTime) throws Exception {
List<AlertTaskInfo> tasks = new ArrayList<>();
EmailConfigurationDTO alertConfig = alertJobContext.getAlertConfig();
long jobExecutionId = alertJobContext.getJobExecutionId();
AlertTaskInfo taskInfo = new AlertTaskInfo(jobExecutionId, monitoringWindowStartTime, monitoringWindowEndTime, alertConfig, null);
tasks.add(taskInfo);
return tasks;
}
use of com.linkedin.thirdeye.anomaly.alert.AlertTaskInfo in project pinot by linkedin.
the class AlertJobRunnerV2 method createTasks.
private List<Long> createTasks(DateTime monitoringWindowStartTime, DateTime monitoringWindowEndTime) {
List<Long> taskIds = new ArrayList<>();
try {
List<AlertTaskInfo> tasks = taskGenerator.createAlertTasksV2(alertJobContext, monitoringWindowStartTime, monitoringWindowEndTime);
for (AlertTaskInfo taskInfo : tasks) {
String taskInfoJson = null;
try {
taskInfoJson = OBJECT_MAPPER.writeValueAsString(taskInfo);
} catch (JsonProcessingException e) {
LOG.error("Exception when converting AlertTaskInfo {} to jsonString", taskInfo, e);
}
TaskDTO taskSpec = new TaskDTO();
taskSpec.setTaskType(TaskConstants.TaskType.ALERT2);
taskSpec.setJobName(alertJobContext.getJobName());
taskSpec.setStatus(TaskConstants.TaskStatus.WAITING);
taskSpec.setStartTime(System.currentTimeMillis());
taskSpec.setTaskInfo(taskInfoJson);
taskSpec.setJobId(alertJobContext.getJobExecutionId());
long taskId = taskDAO.save(taskSpec);
taskIds.add(taskId);
LOG.info("Created alert task {} with taskId {}", taskSpec, taskId);
}
} catch (Exception e) {
LOG.error("Exception in creating alert tasks", e);
}
return taskIds;
}
Aggregations