-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use absolute path for config.default.yaml
in _helpers.py
#1137
base: main
Are you sure you want to change the base?
Use absolute path for config.default.yaml
in _helpers.py
#1137
Conversation
6105670
to
6fabdcc
Compare
With recent commit, prefix was identified for module pypsa_earth:
snakefile:
"submodules/pypsa-earth/Snakefile"
config:
config
prefix:
"submodules/pypsa-earth" Those inputs and outputs (with prefix) are accessed properly when input and outputs of rules are defined explicitly as in almost all rules, except |
@@ -143,7 +143,7 @@ def download_and_unzip_zenodo(config, rootpath, hot_run=True, disable_progress=F | |||
""" | |||
resource = config["category"] | |||
file_path = os.path.join(rootpath, "tempfile.zip") | |||
destination = os.path.relpath(config["destination"]) | |||
destination = os.path.join(PREFIX, config["destination"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you propose PREFIX here instead of BASE_DIR as in the other cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @davide-f. That is the valid point. I have used BASE_DIR as the first try. And it worked fine as standalone for rule execution. But to make sure rules see each other and trigger, outputs and inputs needs to match. So submodules/pypsa-earth/data/eez/eez_v11.gpkg
is not equal to absolute path /home/yerbol/efuels/.../submodules/pypsa-earth/data/eez/eez_v11.gpkg
when it comes to input outputs of snakemake.
With BASE_DIR instead build_shapes
were not triggering retrieve_databundle_light
. But retrieve_databundle_light
worked just fine separately when calling it. CI test actually helped me to figure that out (https://github.com/pypsa-meets-earth/pypsa-earth/actions/runs/11314101704/job/31463655978)
BASE_DIR is good for handling files inside of the script, that are not tight to input/outputs of snakemake. If it is input/output, only PREFIX makes the full workflow intact and preserve rule connections.
Changes proposed in this Pull Request
Good day. Here I propose to use absolute path to
config.default.yaml
in_helpers.py
script. Such change is important while importing PyPSA-Earth rules elsewhere and running then in external directories within another Snakemake. This is helpful for setting workflow.Checklist
doc/release_notes.rst
is amended in the format of previous release notes, including reference to the requested PR.