Skip to content
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

Merged
merged 12 commits into from
Sep 29, 2021

Conversation

downsrob
Copy link
Contributor

@downsrob downsrob commented Sep 15, 2021

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

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

thalurur
thalurur previously approved these changes Sep 27, 2021
Comment on lines +138 to +143
if (delta >= 0) {
long remainingScheduleTime = intervalInMillis - (delta % intervalInMillis);
return Duration.of(remainingScheduleTime, ChronoUnit.MILLIS);
} else {
return Duration.ofMillis(enabledTimeEpochMillis - currentTime.toEpochMilli());
}

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.

Copy link
Contributor Author

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

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?

Copy link
Contributor Author

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

@adityaj1107
Copy link

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.

@downsrob downsrob merged commit 2450767 into opensearch-project:main Sep 29, 2021
@downsrob downsrob deleted the delay-feature branch September 29, 2021 16:48
downsrob added a commit to downsrob/job-scheduler that referenced this pull request Oct 16, 2021
* 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]>
downsrob added a commit that referenced this pull request Oct 19, 2021
* Adds delay parameter to job scheduler

* Adds tests for job scheduler delay parameter

Signed-off-by: Clay Downs <[email protected]>
qreshi added a commit that referenced this pull request Nov 4, 2021
* 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]>
wuychn pushed a commit to ochprince/job-scheduler that referenced this pull request Mar 16, 2023
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants