Repository navigation
fix: standardize handling of resources - #3421
Conversation
📝 WalkthroughWalkthroughThis pull request introduces a comprehensive refactoring of Snakemake's resource management system. It replaces legacy Changes
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120+ minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
ab20f60 to
f98ac7b
Compare
This centralizes the code for resource handling into the
resource.pyfile under a newResourceclass. Notably,DefaultResourceshas been removed, its functionality rolled into the new class. The same class is now used for handling global resource limits, default resources, and rule resource constraintsAs a result of this standarization, the following bugs/inconsistencies are fixed:
mem,mem_mb, andmem_mibcan now be used interchangeably across--resources,--set-resource-scopes,--default-resources,--set-resources, and theresourcekeyword within aSnakefile, as the names are internally standardized.--resources)mem_mbandmem_mibcan no longer be provided a string or a function that returns a string within a rule.{resources}object available within a shell command or parameter context now has access to all versions of a sized resource, e.g.mem,mem_mb,mem_mib.memis now always a string with a unit.A few additional changes:
Resourceclass in snakemake/io.py (that subclassesNamedlistwas renamed toResourceListto prevent confusion. This class is still used within theJobclass and is ultimately passed onto the executor. This ensures compatibility with the existing plugin interface.Outstanding issues (not to be resolved here)
--set-threadswith a python expressionGotchas
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
Release Notes
New Features
Bug Fixes
Refactor