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

Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled #243

Merged
merged 2 commits into from
Dec 13, 2021

Conversation

qreshi
Copy link
Contributor

@qreshi qreshi commented Nov 18, 2021

Signed-off-by: Mohammad Qureshi [email protected]

Issue #, if available: #89

Description of changes:

  • Fixed the case where if an enabled job is de-scheduled when SWEEPER_ENABLED is set to false, jobs that were unchanged were not re-scheduled when SWEEPER_ENABLED was set to back to true
  • Added a manual sweep of all shards when initBackgroundSweep() is called since the runnable being scheduled in the threadpool is only executed for the first time after the SWEEPER_PERIOD (which defaults to 5 minutes) has passed and this could lead to delays in jobs that should run more frequently than that
  • Added a test to capture the changes
  • Confirmed with an anti-test that the written test failed as expected without the fix

CheckList:
[x] 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.

@qreshi qreshi requested a review from a team November 26, 2021 22:23
@codecov-commenter
Copy link

Codecov Report

Merging #243 (4106377) into main (15bb70b) will decrease coverage by 0.08%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #243      +/-   ##
============================================
- Coverage     78.66%   78.57%   -0.09%     
- Complexity      215      218       +3     
============================================
  Files           173      173              
  Lines          6959     6968       +9     
  Branches        912      915       +3     
============================================
+ Hits           5474     5475       +1     
- Misses         1002     1003       +1     
- Partials        483      490       +7     
Impacted Files Coverage Δ
.../kotlin/org/opensearch/alerting/core/JobSweeper.kt 71.50% <75.00%> (-0.76%) ⬇️
...ain/kotlin/org/opensearch/alerting/AlertService.kt 78.04% <0.00%> (-0.98%) ⬇️
...in/kotlin/org/opensearch/alerting/MonitorRunner.kt 71.38% <0.00%> (-0.68%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15bb70b...4106377. Read the comment docs.

@qreshi qreshi merged commit ea7d526 into opensearch-project:main Dec 13, 2021
lezzago pushed a commit to lezzago/alerting-opensearch that referenced this pull request Dec 14, 2021
… is toggled (opensearch-project#243)

* Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update isMonitorScheduled to not use var for returned boolean

Signed-off-by: Mohammad Qureshi <[email protected]>
lezzago pushed a commit to lezzago/alerting-opensearch that referenced this pull request Dec 15, 2021
… is toggled (opensearch-project#243)

* Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update isMonitorScheduled to not use var for returned boolean

Signed-off-by: Mohammad Qureshi <[email protected]>
dblock pushed a commit that referenced this pull request Dec 29, 2021
* Update build.sh to take platform parameter. (#240)

Signed-off-by: Marc Handalian <[email protected]>

* Add a codeowners file (#235)

Signed-off-by: CEHENKLE <[email protected]>

* Update README badge links to refer to OpenSearch Alerting (#244)

Signed-off-by: Mohammad Qureshi <[email protected]>

* Bumps to version 1.3 (#248)

Signed-off-by: Clay Downs <[email protected]>

* Update GitHub Actions to run on all branches (#256)

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled (#243)

* Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update isMonitorScheduled to not use var for returned boolean

Signed-off-by: Mohammad Qureshi <[email protected]>

Co-authored-by: Marc Handalian <[email protected]>
Co-authored-by: CEHENKLE <[email protected]>
Co-authored-by: Mohammad Qureshi <[email protected]>
Co-authored-by: Clay Downs <[email protected]>
AWSHurneyt pushed a commit to AWSHurneyt/OpenSearch-Alerting that referenced this pull request Mar 30, 2022
* Update build.sh to take platform parameter. (opensearch-project#240)

Signed-off-by: Marc Handalian <[email protected]>

* Add a codeowners file (opensearch-project#235)

Signed-off-by: CEHENKLE <[email protected]>

* Update README badge links to refer to OpenSearch Alerting (opensearch-project#244)

Signed-off-by: Mohammad Qureshi <[email protected]>

* Bumps to version 1.3 (opensearch-project#248)

Signed-off-by: Clay Downs <[email protected]>

* Update GitHub Actions to run on all branches (opensearch-project#256)

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled (opensearch-project#243)

* Update sweep logic to re-schedule unchanged jobs when SWEEPER_ENABLED is toggled

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update isMonitorScheduled to not use var for returned boolean

Signed-off-by: Mohammad Qureshi <[email protected]>

Co-authored-by: Marc Handalian <[email protected]>
Co-authored-by: CEHENKLE <[email protected]>
Co-authored-by: Mohammad Qureshi <[email protected]>
Co-authored-by: Clay Downs <[email protected]>
Signed-off-by: AWSHurneyt <[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.

6 participants