Search in sources :

Example 6 with JobDTO

use of com.linkedin.thirdeye.datalayer.dto.JobDTO in project pinot by linkedin.

the class JobResource method listJobsForDataset.

@GET
@Path("/listJobsForDataset")
@Produces(MediaType.APPLICATION_JSON)
public String listJobsForDataset(@NotNull @QueryParam("dataset") String dataset, @DefaultValue("0") @QueryParam("jtStartIndex") int jtStartIndex, @DefaultValue("10") @QueryParam("jtPageSize") int jtPageSize) {
    //    Map<String, Object> filters = new HashMap<>();
    //    filters.put("dataset", dataset);
    //    List<JobDTO> jobDTOs = jobDao.findByParams(filters);
    //TODO: we don't have enough info to find jobs for a dataset, may be we should change this to functions?
    List<JobDTO> jobDTOs = Collections.emptyList();
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(jobDTOs);
    return rootNode.toString();
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) ObjectNode(org.codehaus.jackson.node.ObjectNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 7 with JobDTO

use of com.linkedin.thirdeye.datalayer.dto.JobDTO in project pinot by linkedin.

the class JobResource method listRecentJobs.

@GET
@Path("/listRecentJobs")
@Produces(MediaType.APPLICATION_JSON)
public String listRecentJobs(@DefaultValue("0") @QueryParam("jtStartIndex") int jtStartIndex, @DefaultValue("10") @QueryParam("jtPageSize") int jtPageSize) {
    List<JobDTO> jobDTOs = jobDao.findNRecentJobs(jtStartIndex + jtPageSize);
    List<JobDTO> subList = Utils.sublist(jobDTOs, jtStartIndex, jtPageSize);
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(subList);
    return rootNode.toString();
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) ObjectNode(org.codehaus.jackson.node.ObjectNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 8 with JobDTO

use of com.linkedin.thirdeye.datalayer.dto.JobDTO in project pinot by linkedin.

the class TestAnomalyJobManager method testFindByStatus.

@Test(dependsOnMethods = { "testUpdateStatusAndJobEndTime" })
public void testFindByStatus() {
    JobStatus status = JobStatus.COMPLETED;
    List<JobDTO> anomalyJobs = jobDAO.findByStatus(status);
    Assert.assertEquals(anomalyJobs.size(), 2);
    Assert.assertEquals(anomalyJobs.get(0).getStatus(), status);
}
Also used : JobStatus(com.linkedin.thirdeye.anomaly.job.JobConstants.JobStatus) JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) Test(org.testng.annotations.Test)

Example 9 with JobDTO

use of com.linkedin.thirdeye.datalayer.dto.JobDTO in project pinot by linkedin.

the class TestAnomalyJobManager method testDeleteRecordsOlderThanDaysWithStatus.

@Test(dependsOnMethods = { "testFindByStatus" })
public void testDeleteRecordsOlderThanDaysWithStatus() {
    JobStatus status = JobStatus.COMPLETED;
    int numRecordsDeleted = jobDAO.deleteRecordsOlderThanDaysWithStatus(0, status);
    Assert.assertEquals(numRecordsDeleted, 2);
    List<JobDTO> anomalyJobs = jobDAO.findByStatus(status);
    Assert.assertEquals(anomalyJobs.size(), 0);
}
Also used : JobStatus(com.linkedin.thirdeye.anomaly.job.JobConstants.JobStatus) JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) Test(org.testng.annotations.Test)

Example 10 with JobDTO

use of com.linkedin.thirdeye.datalayer.dto.JobDTO in project pinot by linkedin.

the class TestAnomalyJobManager method printAll.

private void printAll(String msg) {
    List<JobDTO> allAnomalyJobs = jobDAO.findAll();
    System.out.println("START:ALL JOB after:" + msg);
    for (JobDTO jobDTO : allAnomalyJobs) {
        System.out.println(jobDTO);
    }
    System.out.println("END:ALL JOB after:" + msg);
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO)

Aggregations

JobDTO (com.linkedin.thirdeye.datalayer.dto.JobDTO)19 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)5 Test (org.testng.annotations.Test)5 JobStatus (com.linkedin.thirdeye.anomaly.job.JobConstants.JobStatus)3 TaskDTO (com.linkedin.thirdeye.datalayer.dto.TaskDTO)2 JobBean (com.linkedin.thirdeye.datalayer.pojo.JobBean)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 ObjectNode (org.codehaus.jackson.node.ObjectNode)2 DateTime (org.joda.time.DateTime)2 JobExecutionException (org.quartz.JobExecutionException)2 Transactional (com.google.inject.persist.Transactional)1 DataCompletenessTaskInfo (com.linkedin.thirdeye.completeness.checker.DataCompletenessTaskInfo)1 JobManager (com.linkedin.thirdeye.datalayer.bao.JobManager)1 TaskManager (com.linkedin.thirdeye.datalayer.bao.TaskManager)1 MergedAnomalyResultDTO (com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO)1 RawAnomalyResultDTO (com.linkedin.thirdeye.datalayer.dto.RawAnomalyResultDTO)1 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)1 ArrayList (java.util.ArrayList)1