Skip to content

Avoid the use use of workflow.source_path#893

Merged
fneum merged 2 commits intoPyPSA:masterfrom
koen-vg:fix-source-path
Jan 24, 2024
Merged

Avoid the use use of workflow.source_path#893
fneum merged 2 commits intoPyPSA:masterfrom
koen-vg:fix-source-path

Conversation

@koen-vg
Copy link
Copy Markdown
Contributor

@koen-vg koen-vg commented Jan 24, 2024

The above function returns a path to a cached source file, which changes for every run, causing the resulting parameter to change and the solve_network rule to re-run every time. The problem was introduced in d145758

I have tested the solution, and also tested to make sure this works when pypsa-eur is used as a module.

Checklist

  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in all of config.default.yaml.
  • Changes in configuration options are also documented in doc/configtables/*.csv.
  • A release note doc/release_notes.rst is added.

The above function returns a path to a cached source file, which
changes for every run, causing the resulting parameter to change and
the solve_network rule to re-run
Copy link
Copy Markdown
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting! This is a big downside of using workflow.source_path() for any place (input, param) and probably not intended by the snakemake developers. Thanks for finding the issue and providing the fix!

@fneum fneum enabled auto-merge January 24, 2024 15:19
@fneum fneum disabled auto-merge January 24, 2024 15:57
@fneum fneum merged commit 5980618 into PyPSA:master Jan 24, 2024
@koen-vg koen-vg deleted the fix-source-path branch January 24, 2024 16:09
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