Skip to content

Fix lock releasing logic in scheduler#1031

Merged
GlassOfWhiskey merged 2 commits into
masterfrom
fix-scheduler-locks
Apr 18, 2026
Merged

Fix lock releasing logic in scheduler#1031
GlassOfWhiskey merged 2 commits into
masterfrom
fix-scheduler-locks

Conversation

@GlassOfWhiskey
Copy link
Copy Markdown
Member

@GlassOfWhiskey GlassOfWhiskey commented Apr 16, 2026

This commit streamlines the DefaultScheduler by removing the wait_queues and locks attributes for each deployment and introducing a single wait_queue. Previously, the combination of double locks added unnecessary complexity and was difficult to maintain. Furthermore, stacked deployments were not handled properly, leading to deadlocks or exceptions when the retry_interval attribute was not defined by the user.
Now, when a job frees resources, the waiting jobs are notified.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.27%. Comparing base (587d42c) to head (3f8f4be).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
streamflow/scheduling/scheduler.py 80.00% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1031      +/-   ##
==========================================
- Coverage   74.36%   74.27%   -0.10%     
==========================================
  Files          90       90              
  Lines       12496    12469      -27     
  Branches     2193     2182      -11     
==========================================
- Hits         9293     9261      -32     
- Misses       2682     2689       +7     
+ Partials      521      519       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit fixes the lock releasing logic in the `DefaultScheduler`
class, avoiding spurious calls to the `release` method of a `Lock`
object aftere waking up on a `Condition` variable.
@LanderOtto LanderOtto force-pushed the fix-scheduler-locks branch from e317586 to e1cfaf9 Compare April 17, 2026 14:07
@LanderOtto LanderOtto force-pushed the fix-scheduler-locks branch from e1cfaf9 to 3f8f4be Compare April 17, 2026 14:19
@GlassOfWhiskey GlassOfWhiskey marked this pull request as ready for review April 18, 2026 10:58
@GlassOfWhiskey GlassOfWhiskey merged commit 7a61258 into master Apr 18, 2026
158 of 161 checks passed
@GlassOfWhiskey GlassOfWhiskey deleted the fix-scheduler-locks branch April 18, 2026 13:26
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.

2 participants