jihaozh commented on a change in pull request #5398:
URL: https://github.com/apache/incubator-pinot/pull/5398#discussion_r428391511



##########
File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/scheduler/DetectionCronScheduler.java
##########
@@ -79,28 +81,45 @@ public void run() {
 
       // add or update
       for (DetectionConfigDTO config : configs) {
-        JobKey key = new JobKey(getJobKey(config.getId()), 
TaskConstants.TaskType.DETECTION.toString());
         if (!config.isActive()) {
-          LOG.debug("Detection config " + key + " is inactive. Skipping.");
+          LOG.debug("Detection config " + config.getId() + " is inactive. 
Skipping.");
           continue;
         }
-        if (DetectionUtils.isDataAvailabilityCheckEnabled(config)) {
-          LOG.debug("Detection config " + key + " is enabled for data 
availability scheduling. Skipping.");
+        if (config.isDataAvailabilitySchedule()) {
+          LOG.debug("Detection config " + config.getId() + " is enabled for 
data availability scheduling. Skipping.");
           continue;
         }
+
         try {
-          if (scheduler.checkExists(key)) {
-            LOG.info("Detection config  " + key.getName() + " is already 
scheduled");
-            if (isJobUpdated(config, key)) {
-              // restart job
-              stopJob(key);
-              startJob(config, key);
+          // Schedule detection jobs
+          JobKey detectionJobKey = new JobKey(getJobKey(config.getId(), 
TaskConstants.TaskType.DETECTION),
+              QUARTZ_DETECTION_GROUPER);
+          JobDetail detectionJob = 
JobBuilder.newJob(DetectionPipelineJob.class).withIdentity(detectionJobKey).build();
+          if (scheduler.checkExists(detectionJobKey)) {
+            LOG.info("Detection config " + detectionJobKey.getName() + " is 
already scheduled for detection");
+            if (isJobUpdated(config, detectionJobKey)) {
+              restartJob(config, detectionJob);
+            }
+          } else {
+            startJob(config, detectionJob);
+          }
+
+          // Schedule data quality jobs
+          JobKey dataQualityJobKey = new JobKey(getJobKey(config.getId(), 
TaskConstants.TaskType.DATA_QUALITY),
+              QUARTZ_DETECTION_GROUPER);
+          JobDetail dataQualityJob = 
JobBuilder.newJob(DataQualityPipelineJob.class).withIdentity(dataQualityJobKey).build();

Review comment:
       will there be a case that the detection and data quality check has 
different corn?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to