use of com.linkedin.thirdeye.datalayer.dto.TaskDTO in project pinot by linkedin.
the class JobResource method listTasksForJob.
@GET
@Path("/listTasksForJob")
@Produces(MediaType.APPLICATION_JSON)
public String listTasksForJob(@NotNull @QueryParam("jobId") long jobId) {
Map<String, Object> filters = new HashMap<>();
filters.put("jobId", jobId);
List<TaskDTO> taskDTOs = taskDao.findByParams(filters);
ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(taskDTOs);
return rootNode.toString();
}
use of com.linkedin.thirdeye.datalayer.dto.TaskDTO in project pinot by linkedin.
the class TaskManagerImpl method findByStatusOrderByCreateTime.
@Override
public List<TaskDTO> findByStatusOrderByCreateTime(TaskStatus status, int fetchSize, boolean asc) {
Map<String, Object> parameterMap = new HashMap<>();
parameterMap.put("status", status.toString());
List<TaskBean> list;
String queryClause = (asc) ? FIND_BY_STATUS_ORDER_BY_CREATE_TIME_ASC : FIND_BY_STATUS_ORDER_BY_CREATE_TIME_DESC;
list = genericPojoDao.executeParameterizedSQL(queryClause, parameterMap, TaskBean.class);
List<TaskDTO> result = new ArrayList<>();
for (TaskBean bean : list) {
result.add((TaskDTO) MODEL_MAPPER.map(bean, TaskDTO.class));
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.TaskDTO in project pinot by linkedin.
the class GenericResultSetMapper method main.
public static void main(String[] args) throws Exception {
ModelMapper mapper = new ModelMapper();
Map<String, Object> result = new HashMap<>();
//[{jobName=Test_Anomaly_Task, jobId=1, workerId=1, taskType=MONITOR, id=1, taskInfo=clob2: '{"jobExecutionId":1,"monitorType":"UPDATE","expireDaysAgo":0}', lastModified=2016-08-24 17:25:53.258, version=0, taskStartTime=1470356753227, status=RUNNING, taskEndTime=1471220753227}]
result.put("jobName", "Test_Anomaly_Task");
result.put("jobId", 1L);
result.put("taskType", "MONITOR");
result.put("id", 1L);
result.put("taskInfo", "clob2: '{\"jobExecutionId\":1,\"monitorType\":\"UPDATE\",\"expireDaysAgo\":0}'");
result.put("taskType", "MONITOR");
result.put("lastModified", "2016-08-24 17:25:53.258");
result.put("status", "RUNNING");
result.put("lastModified", "2016-08-24 17:25:53.258");
TaskDTO taskSpec1 = mapper.map(result, TaskDTO.class);
System.out.println(taskSpec1);
//INPUT 2
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("/tmp/map.out.1472093046128")));
Map<String, Object> inputMap = (Map<String, Object>) ois.readObject();
TaskDTO taskSpec2 = mapper.map(inputMap, TaskDTO.class);
System.out.println(taskSpec2);
}
use of com.linkedin.thirdeye.datalayer.dto.TaskDTO in project pinot by linkedin.
the class TestAnomalyTaskManager method testUpdateStatusAndTaskEndTime.
@Test(dependsOnMethods = { "testFindByStatusOrderByCreationTimeAsc" })
public void testUpdateStatusAndTaskEndTime() {
TaskStatus oldStatus = TaskStatus.RUNNING;
TaskStatus newStatus = TaskStatus.COMPLETED;
long taskEndTime = System.currentTimeMillis();
taskDAO.updateStatusAndTaskEndTime(anomalyTaskId1, oldStatus, newStatus, taskEndTime);
TaskDTO anomalyTask = taskDAO.findById(anomalyTaskId1);
Assert.assertEquals(anomalyTask.getStatus(), newStatus);
Assert.assertEquals(anomalyTask.getEndTime(), taskEndTime);
}
use of com.linkedin.thirdeye.datalayer.dto.TaskDTO in project pinot by linkedin.
the class TestAnomalyTaskManager method getTestTaskSpec.
TaskDTO getTestTaskSpec(JobDTO anomalyJobSpec) throws JsonProcessingException {
TaskDTO jobSpec = new TaskDTO();
jobSpec.setJobName("Test_Anomaly_Task");
jobSpec.setStatus(TaskStatus.WAITING);
jobSpec.setTaskType(TaskType.ANOMALY_DETECTION);
jobSpec.setStartTime(new DateTime().minusDays(20).getMillis());
jobSpec.setEndTime(new DateTime().minusDays(10).getMillis());
jobSpec.setTaskInfo(new ObjectMapper().writeValueAsString(getTestDetectionTaskInfo()));
jobSpec.setJobId(anomalyJobSpec.getId());
return jobSpec;
}
Aggregations