Search in sources :

Example 16 with JobDTO

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

the class DataCompletenessJobRunner method createJob.

public Long createJob() {
    Long jobExecutionId = null;
    try {
        LOG.info("Creating data completeness job");
        JobDTO jobSpec = new JobDTO();
        jobSpec.setJobName(dataCompletenessJobContext.getJobName());
        jobSpec.setScheduleStartTime(System.currentTimeMillis());
        jobSpec.setStatus(JobStatus.SCHEDULED);
        jobExecutionId = DAO_REGISTRY.getJobDAO().save(jobSpec);
        LOG.info("Created JobSpec {} with jobExecutionId {}", jobSpec, jobExecutionId);
    } catch (Exception e) {
        LOG.error("Exception in creating data completeness job", e);
    }
    return jobExecutionId;
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 17 with JobDTO

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

the class JobManagerImpl method updateStatusAndJobEndTimeForJobIds.

@Override
@Transactional
public void updateStatusAndJobEndTimeForJobIds(Set<Long> ids, JobStatus status, Long jobEndTime) {
    for (Long id : ids) {
        JobDTO anomalyJobSpec = findById(id);
        anomalyJobSpec.setStatus(status);
        anomalyJobSpec.setScheduleEndTime(jobEndTime);
        update(anomalyJobSpec);
    }
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) Transactional(com.google.inject.persist.Transactional)

Example 18 with JobDTO

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

the class JobManagerImpl method findLatestScheduledJobByName.

@Override
public JobDTO findLatestScheduledJobByName(String jobName) {
    Predicate namePredicate = Predicate.EQ("name", jobName);
    Predicate statusPredicate = Predicate.EQ("status", "SCHEDULED");
    List<JobBean> list = genericPojoDao.get(Predicate.AND(statusPredicate, namePredicate), JobBean.class);
    if (CollectionUtils.isNotEmpty(list)) {
        JobDTO dto = convertBean2DTO(list.get(0), JobDTO.class);
        return dto;
    }
    return null;
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) JobBean(com.linkedin.thirdeye.datalayer.pojo.JobBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 19 with JobDTO

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

the class JobManagerImpl method findNRecentJobs.

@Override
public List<JobDTO> findNRecentJobs(int n) {
    String parameterizedSQL = "order by scheduleStartTime desc limit " + n;
    HashMap<String, Object> parameterMap = new HashMap<>();
    List<JobBean> list = genericPojoDao.executeParameterizedSQL(parameterizedSQL, parameterMap, JobBean.class);
    List<JobDTO> ret = new ArrayList<>();
    for (JobBean bean : list) {
        JobDTO dto = convertBean2DTO(bean, JobDTO.class);
        ret.add(dto);
    }
    return ret;
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) HashMap(java.util.HashMap) JobBean(com.linkedin.thirdeye.datalayer.pojo.JobBean) ArrayList(java.util.ArrayList)

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