fix: restore accidentally changed behavior of --cores. If not specified, Snakemake now complains again, asking for --cores to be specified (of --jobs in case of remote exec). As before, if a default is desired, it can be easily set via a profile#3531
Merged
johanneskoester merged 2 commits intomainfrom Apr 14, 2025
Merged
Conversation
…ed, Snakemake now complains again, asking for --cores to be specified (of --jobs in case of remote exec). As before, if a default is desired, it can be easily set via a profile
Contributor
📝 Walkthrough## Walkthrough
The change removes a fallback assignment in the command-line interface logic where the number of CPU cores (`args.cores`) would default to the system's available CPU count if not explicitly set. After this modification, if no value is provided for `args.cores` through prior logic, it will remain `None`. Additionally, test code was updated to avoid raising `None` exceptions and to explicitly specify `--cores 1` in certain test Snakemake command invocations. No other logic or function signatures are affected.
## Changes
| File(s) | Change Summary |
|------------------------------|-----------------------------------------------------------------------------------------------|
| src/snakemake/cli.py | Removed fallback code that set `args.cores` to the available CPU count if it was still `None`. |
| tests/common.py | Modified error handling to raise exceptions only if they are not `None` after failed runs. |
| tests/tests.py | Added `--cores 1` option to Snakemake shell commands in two test functions. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant CLI
User->>CLI: Provide command-line arguments (may omit --cores)
CLI->>CLI: Process arguments
alt --cores provided or set by earlier logic
CLI->>CLI: Use specified value for args.cores
else --cores not set
CLI->>CLI: args.cores remains None (no fallback assignment)
end |
johanneskoester
pushed a commit
that referenced
this pull request
Apr 14, 2025
🤖 I have created a release *beep* *boop* --- ## [9.2.0](v9.1.11...v9.2.0) (2025-04-14) ### Features * auto detect string resources in resource definitions given by --default-resources and --set-resources in the string yields a syntax error when being interpreted as a python expression; this will obviate the need to quote such expressions in many cases; further, fix interpretation of quoted resources by removing quotes after intepretation ([#3532](#3532)) ([81f09bd](81f09bd)) ### Bug Fixes * restore accidentally changed behavior of --cores. If not specified, Snakemake now complains again, asking for --cores to be specified (of --jobs in case of remote exec). As before, if a default is desired, it can be easily set via a profile ([#3531](#3531)) ([11b2b30](11b2b30)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Contributor
|
Just got caught out by this change with the (new to me) error:
Easy to work arround with an explicit |
7 tasks
kjohnsen
pushed a commit
to kjohnsen/snakemake
that referenced
this pull request
Dec 15, 2025
…ed, Snakemake now complains again, asking for --cores to be specified (of --jobs in case of remote exec). As before, if a default is desired, it can be easily set via a profile (snakemake#3531) ### Description <!--Add a description of your PR here--> ### 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 - **Refactor** - Updated the logic for assigning CPU cores, removing the automatic fallback to available CPU count when not explicitly set. - **Bug Fixes** - Improved error handling to avoid raising null exceptions after failed executions. - **Tests** - Modified test commands to explicitly specify single-core usage during runs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
kjohnsen
pushed a commit
to kjohnsen/snakemake
that referenced
this pull request
Dec 15, 2025
🤖 I have created a release *beep* *boop* --- ## [9.2.0](snakemake/snakemake@v9.1.11...v9.2.0) (2025-04-14) ### Features * auto detect string resources in resource definitions given by --default-resources and --set-resources in the string yields a syntax error when being interpreted as a python expression; this will obviate the need to quote such expressions in many cases; further, fix interpretation of quoted resources by removing quotes after intepretation ([snakemake#3532](snakemake#3532)) ([81f09bd](snakemake@81f09bd)) ### Bug Fixes * restore accidentally changed behavior of --cores. If not specified, Snakemake now complains again, asking for --cores to be specified (of --jobs in case of remote exec). As before, if a default is desired, it can be easily set via a profile ([snakemake#3531](snakemake#3531)) ([11b2b30](snakemake@11b2b30)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
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