Skip to content

Commit 4e59963

Browse files
authored
fix: return empty set if rate limiter at max (#3060)
<!--Add a description of your PR here--> When running locally with a rate limiter, if rate limiter reaches the max number of jobs `job_selector` function returns `None` and snakemake fails on line: https://github.com/snakemake/snakemake/blob/f9554786e9d7f81c0195e0d9ab3c22b7fe611799/snakemake/scheduler.py#L278-L281 with error: ``` TypeError: object of type 'NoneType' has no len() ``` ### QC <!-- Make sure that you can tick the boxes below. --> * [ ] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [ ] 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** - Improved job selection logic to ensure an empty set is returned when no free jobs are available, enhancing system reliability and preventing unintended behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a540a2e commit 4e59963

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

snakemake/scheduler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ def job_selector(self, jobs):
479479
n_free_jobs = self.job_rate_limiter.get_free_jobs()
480480
if n_free_jobs == 0:
481481
logger.info("Job rate limit reached, waiting for free slots.")
482+
return set()
482483
else:
483484
self.resources["_job_count"] = n_free_jobs
484485
selected = self._job_selector(jobs)

0 commit comments

Comments
 (0)