-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a delay parameter to the job scheduler #61
Conversation
Signed-off-by: Robert Downs <[email protected]>
Signed-off-by: Robert Downs <[email protected]>
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/IntervalSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/IntervalSchedule.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/Schedule.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/IntervalSchedule.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/IntervalSchedule.java
Outdated
Show resolved
Hide resolved
if (delta >= 0) { | ||
long remainingScheduleTime = intervalInMillis - (delta % intervalInMillis); | ||
return Duration.of(remainingScheduleTime, ChronoUnit.MILLIS); | ||
} else { | ||
return Duration.ofMillis(enabledTimeEpochMillis - currentTime.toEpochMilli()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment on Ternary operators! Simplification of code increases its readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also a big fan of ternary operators! But I try to only use them in simple cases, and I really try to not include anything that takes much thought. I agree with you on the other cases but I will leave this one as an if/else for that reason
@@ -49,7 +49,7 @@ Then you will find the built artifact located at `build/distributions` directory | |||
## Install | |||
Once you have built the plugin from source code, run | |||
```bash | |||
opensearch-plugin install file://${PLUGIN_ZIP_FILE_PATH} | |||
opensearch-plugin install file:///path/to/target/releases/opensearch-job-scheduler-<version>.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on adding the example path to target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this very much, but this follows another plugin: https://github.com/opensearch-project/security-dashboards-plugin/blob/ad6e723d4710b91cbcf1f0ec543b6ec24b976c53/DEVELOPER_GUIDE.md and this change lets the lychee link checker succeed
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/main/java/org/opensearch/jobscheduler/spi/schedule/CronSchedule.java
Outdated
Show resolved
Hide resolved
spi/src/test/java/org/opensearch/jobscheduler/spi/schedule/IntervalScheduleTests.java
Outdated
Show resolved
Hide resolved
I have taken a cursory pass! I have minor comments. If this is a blocker for a release, I can approve it. O/w we can address these comments and get this one into production then. |
Signed-off-by: Clay Downs <[email protected]>
* Adds delay parameter to job scheduler * Adds tests for job scheduler delay parameter * Changes test and build workflow to 1.1 and corrects links Signed-off-by: Clay Downs <[email protected]>
* Adds delay parameter to job scheduler * Adds tests for job scheduler delay parameter Signed-off-by: Clay Downs <[email protected]>
* Enabled automated license header checks (#36) 1. Re-enabled the 'licenseHeaders' check in the build.gradle file. 2. Added an IntelliJ copyright profile to auto-generate the SPDX license header. Signed-off-by: Ketan Verma <[email protected]> * Release 1.0.0.0 (#40) Signed-off-by: bowenlan-amzn <[email protected]> * Bumping job-scheduler to build with OpenSearch(main) 1.1.0 (#44) * Bumping job-scheduler to build with OpenSearch(main) 1.1.0 Signed-off-by: Sarat Vemulapalli <[email protected]> * Updating docs link to our documentation website. Signed-off-by: Sarat Vemulapalli <[email protected]> * Using 1.1 snapshot version for OpenSearch (#48) Signed-off-by: Vacha <[email protected]> * Use standard snapshot build settings and OpenSearch 1.x. (#49) Signed-off-by: dblock <[email protected]> * Add `Getting Started` to Readme (#50) * added Getting Started section * Adds a delay parameter to the job scheduler (#61) * Adds delay parameter to job scheduler * Adds tests for job scheduler delay parameter * Changes test and build workflow to 1.1 and corrects links Signed-off-by: Clay Downs <[email protected]> * Updates job scheduler version to 1.2 (#68) * Updates job scheduler version to 1.2 and uses Maven for 1.2 dependencies Signed-off-by: Clay Downs <[email protected]> * Publish MD5 and SHA1 signatures. (#71) * Publish MD5 and SHA1 signatures. Signed-off-by: dblock <[email protected]> * Also publish 256 and 512 checksums. Signed-off-by: dblock <[email protected]> * Fixes possible negative jitter (#78) Signed-off-by: Drew Baugher <[email protected]> Co-authored-by: Ketan Verma <[email protected]> Co-authored-by: Bowen Lan <[email protected]> Co-authored-by: Sarat Vemulapalli <[email protected]> Co-authored-by: Vacha <[email protected]> Co-authored-by: Daniel Doubrovkine (dB.) <[email protected]> Co-authored-by: Sriram <[email protected]> Co-authored-by: Clay Downs <[email protected]> Co-authored-by: Drew Baugher <[email protected]>
* Adds delay parameter to job scheduler * Adds tests for job scheduler delay parameter * Changes test and build workflow to 1.1 and corrects links Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs [email protected]
Description
Adds a delay parameter to the job scheduler which allows plugins to put off execution time by a fixed number of milliseconds. For example, an interval schedule which starts at 10 AM with a delay of 3 minutes and an interval of 7 minutes would run at 10:03 AM, then 10:10 AM, then 10:17 AM and so on. This parameter is being added to enable plugins to easily add a delay to job schedules without parsing and modifying the user defined interval or cron schedule.
This index state management PR depends on this job scheduler change to add the delay feature to ISM rollup jobs.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.