fix: ensure that queue input jobs wait if the queue is still empty upon job creation#3866
fix: ensure that queue input jobs wait if the queue is still empty upon job creation#3866johanneskoester merged 4 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughRelaxes a DAG postprocess assertion to allow unfinished queue-input jobs, changes per-queue list storage to a set when collecting from-queue identifiers, and adds a 20-second initial sleep to the queue-input test to reproduce timing-related behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Please format your code with |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/snakemake/dag.py (1)
1941-1947: New assertion fully disables the “no-ready-jobs” bug check whenever any unfinished queue-input job existsThe updated assertion:
if check_initial: assert self.has_unfinished_queue_input_jobs() or ( not any(self.needrun_jobs()) or any(self.ready_jobs) ), "bug: DAG contains jobs that have to be executed but no such job is ready for execution."treats the mere presence of any unfinished queue-input job as sufficient to bypass the original invariant. In a mixed workflow (queue-input + normal jobs), this could allow a situation where there are non‑queue jobs that need to run, no jobs are ready, yet the assertion does not fire because at least one unrelated queue-input job is unfinished.
To keep the intended fix while preserving the original invariant for non‑queue‑blocked jobs, consider narrowing the exemption to jobs whose “needrun” status is entirely due to unfinished queue input. For example:
if check_initial: # Only enforce the invariant on jobs that are not blocked by unfinished queue input has_nonqueue_needrun = any( job for job in self.needrun_jobs() if not job.has_unfinished_queue_input() ) assert (not has_nonqueue_needrun) or any(self.ready_jobs), ( "bug: DAG contains jobs that have to be executed but no such job is " "ready for execution." )This still allows the initial state where all pending work is queue‑input‑blocked (your bugfix case), but will continue to flag a DAG where non‑queue jobs need to run and none are ready.
If you’d like, I can also propose a small test variant that mixes queue and non‑queue jobs to exercise this edge case.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/snakemake/dag.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
⚙️ CodeRabbit configuration file
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Files:
src/snakemake/dag.py
🧠 Learnings (2)
📚 Learning: 2024-10-14T09:42:11.571Z
Learnt from: johanneskoester
Repo: snakemake/snakemake PR: 3140
File: snakemake/dag.py:1308-1308
Timestamp: 2024-10-14T09:42:11.571Z
Learning: In `snakemake/dag.py`, avoid flagging missing lines or indentation issues when there is no clear syntax or logical error to prevent false positives.
Applied to files:
src/snakemake/dag.py
📚 Learning: 2024-11-12T12:08:20.342Z
Learnt from: johanneskoester
Repo: snakemake/snakemake PR: 3148
File: snakemake/dag.py:1332-1336
Timestamp: 2024-11-12T12:08:20.342Z
Learning: In `snakemake/dag.py`, when code is outdated and will disappear upon resolving merge conflicts, avoid making code review suggestions on that code.
Applied to files:
src/snakemake/dag.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: apidocs
🤖 I have created a release *beep* *boop* --- ## [9.14.3](v9.14.2...v9.14.3) (2025-12-08) ### Bug Fixes * ensure that queue input jobs wait if the queue is still empty upon job creation ([#3866](#3866)) ([555ab6a](555ab6a)) * fix issues with cyclic dependencies when using the update and before_update flag ([#3857](#3857)) ([21cc94e](21cc94e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…on job creation (snakemake#3866) fixes snakemake#3852 ### QC <!-- Make sure that you can tick the boxes below. --> * [x] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [x] The documentation (`docs/`) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Relaxed scheduling readiness checks to correctly handle pending queued input jobs and avoid spurious assertion errors. * **Refactor** * Simplified tracking of queue inputs for leaner, more reliable processing. * **Tests** * Updated queue-input test timing to align with the revised scheduling behavior. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
🤖 I have created a release *beep* *boop* --- ## [9.14.3](snakemake/snakemake@v9.14.2...v9.14.3) (2025-12-08) ### Bug Fixes * ensure that queue input jobs wait if the queue is still empty upon job creation ([snakemake#3866](snakemake#3866)) ([555ab6a](snakemake@555ab6a)) * fix issues with cyclic dependencies when using the update and before_update flag ([snakemake#3857](snakemake#3857)) ([21cc94e](snakemake@21cc94e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
fixes #3852
QC
docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).Summary by CodeRabbit
Bug Fixes
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.