You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "ruanwenjun (via GitHub)" <gi...@apache.org> on 2024/03/29 11:26:04 UTC

[PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

ruanwenjun opened a new pull request, #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781

   ## Purpose of the pull request
   
   Optimize the scheduler code in quartz plugin, use quartz replace API to insert/update trigger and job.
   
   ## Brief change log
   
   <!--*(for example:)*
   - *Add maven-checkstyle-plugin to root pom.xml*
   -->
   
   ## Verify this pull request
   
   <!--*(Please pick either of the following options)*-->
   
   This pull request is code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added dolphinscheduler-dao tests for end-to-end.*
   - *Added CronUtilsTest to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   (or)
   
   If your pull request contain incompatible change, you should also add it to `docs/docs/en/guide/upgrede/incompatible.md`
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2027895034

   > It's ok to remove lock when build job details and schedule?
   
   We don't need to use lock here.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2031126210

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [30.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15781&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2027954944

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [30.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15781&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "qingwli (via GitHub)" <gi...@apache.org>.
qingwli commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2027888778

   It's ok to remove lock when build job details and schedule?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2028795983

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [30.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15781&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#discussion_r1545051819


##########
dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzCornTriggerBuilder.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.scheduler.quartz;
+
+import static org.quartz.CronScheduleBuilder.cronSchedule;
+import static org.quartz.TriggerBuilder.newTrigger;
+
+import org.apache.dolphinscheduler.common.utils.DateUtils;
+import org.apache.dolphinscheduler.dao.entity.Schedule;
+
+import java.util.Date;
+
+import org.quartz.CronTrigger;
+import org.quartz.JobKey;
+import org.quartz.TriggerKey;
+
+/**
+ * QuartzCornTriggerBuilder used to build a {@link CronTrigger} instance.
+ */
+public class QuartzCornTriggerBuilder implements QuartzTriggerBuilder {
+
+    private Integer projectId;
+
+    private Schedule schedule;
+
+    public static QuartzCornTriggerBuilder newBuilder() {
+        return new QuartzCornTriggerBuilder();
+    }
+
+    public QuartzCornTriggerBuilder withProjectId(Integer projectId) {
+        this.projectId = projectId;
+        return this;
+    }
+
+    public QuartzCornTriggerBuilder withSchedule(Schedule schedule) {
+        this.schedule = schedule;
+        return this;
+    }
+
+    public CronTrigger build() {

Review Comment:
   ## Missing Override annotation
   
   This method overrides [QuartzTriggerBuilder.build](1); it is advisable to add an Override annotation.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/4093)



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2027953624

   ## [Codecov](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `31.00000%` with `69 lines` in your changes are missing coverage. Please review.
   > Project coverage is 39.09%. Comparing base [(`dc4dad1`)](https://app.codecov.io/gh/apache/dolphinscheduler/commit/dc4dad135c9ccacd376dfa139f174eb0dd086b24?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`8abdbea`)](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   > :exclamation: Current head 8abdbea differs from pull request most recent head 713add8. Consider uploading reports for the commit 713add8 to get more accurate results
   
   | [Files](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...ler/scheduler/quartz/QuartzCornTriggerBuilder.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1zY2hlZHVsZXItcGx1Z2luL2RvbHBoaW5zY2hlZHVsZXItc2NoZWR1bGVyLXF1YXJ0ei9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9zY2hlZHVsZXIvcXVhcnR6L1F1YXJ0ekNvcm5UcmlnZ2VyQnVpbGRlci5qYXZh) | 0.00% | [26 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...hinscheduler/scheduler/quartz/QuartzScheduler.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1zY2hlZHVsZXItcGx1Z2luL2RvbHBoaW5zY2hlZHVsZXItc2NoZWR1bGVyLXF1YXJ0ei9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9zY2hlZHVsZXIvcXVhcnR6L1F1YXJ0elNjaGVkdWxlci5qYXZh) | 0.00% | [19 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...duler/scheduler/quartz/QuartzJobDetailBuilder.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1zY2hlZHVsZXItcGx1Z2luL2RvbHBoaW5zY2hlZHVsZXItc2NoZWR1bGVyLXF1YXJ0ei9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9zY2hlZHVsZXIvcXVhcnR6L1F1YXJ0ekpvYkRldGFpbEJ1aWxkZXIuamF2YQ==) | 0.00% | [15 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...cheduler/scheduler/quartz/ProcessScheduleTask.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1zY2hlZHVsZXItcGx1Z2luL2RvbHBoaW5zY2hlZHVsZXItc2NoZWR1bGVyLXF1YXJ0ei9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9zY2hlZHVsZXIvcXVhcnR6L1Byb2Nlc3NTY2hlZHVsZVRhc2suamF2YQ==) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...lphinscheduler/scheduler/quartz/QuartzJobData.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1zY2hlZHVsZXItcGx1Z2luL2RvbHBoaW5zY2hlZHVsZXItc2NoZWR1bGVyLXF1YXJ0ei9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9zY2hlZHVsZXIvcXVhcnR6L1F1YXJ0ekpvYkRhdGEuamF2YQ==) | 75.00% | [2 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...scheduler/quartz/QuartzSchedulerConfiguration.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1zY2hlZHVsZXItcGx1Z2luL2RvbHBoaW5zY2hlZHVsZXItc2NoZWR1bGVyLXF1YXJ0ei9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZG9scGhpbnNjaGVkdWxlci9zY2hlZHVsZXIvcXVhcnR6L1F1YXJ0elNjaGVkdWxlckNvbmZpZ3VyYXRpb24uamF2YQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##                dev   #15781      +/-   ##
   ============================================
   - Coverage     39.16%   39.09%   -0.08%     
   - Complexity     4867     4878      +11     
   ============================================
     Files          1316     1325       +9     
     Lines         44978    45110     +132     
     Branches       4803     4790      -13     
   ============================================
   + Hits          17617    17634      +17     
   - Misses        25477    25590     +113     
   - Partials       1884     1886       +2     
   ```
   
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dolphinscheduler/pull/15781?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun merged PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2028796063

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [30.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15781&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2031127148

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [30.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15781&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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


Re: [PR] Directly use Quartz replase api to bootstrap a schedule [dolphinscheduler]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #15781:
URL: https://github.com/apache/dolphinscheduler/pull/15781#issuecomment-2027955064

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [30.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=15781&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=15781)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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