snakefmt to Snakefile
This commit is contained in:
parent
bf895de7cc
commit
7405377fd7
19
Snakefile
19
Snakefile
@ -33,7 +33,10 @@ BENCHMARKS = "benchmarks/" + RDIR
|
||||
RESOURCES = "resources/" + RDIR if not run.get("shared_resources") else "resources/"
|
||||
RESULTS = "results/" + RDIR
|
||||
|
||||
localrules: purge
|
||||
|
||||
localrules:
|
||||
purge,
|
||||
|
||||
|
||||
wildcard_constraints:
|
||||
simpl="[a-zA-Z0-9]*",
|
||||
@ -42,6 +45,7 @@ wildcard_constraints:
|
||||
opts="[-+a-zA-Z0-9\.]*",
|
||||
sector_opts="[-+a-zA-Z0-9\.\s]*",
|
||||
|
||||
|
||||
include: "rules/common.smk"
|
||||
include: "rules/collect.smk"
|
||||
include: "rules/retrieve.smk"
|
||||
@ -62,22 +66,25 @@ if config["foresight"] == "myopic":
|
||||
|
||||
|
||||
rule purge:
|
||||
message: "Purging generated resources and results. Downloads are kept."
|
||||
message:
|
||||
"Purging generated resources and results. Downloads are kept."
|
||||
run:
|
||||
rmtree("resources/")
|
||||
rmtree("results/")
|
||||
|
||||
|
||||
rule dag:
|
||||
message: "Creating DAG of workflow."
|
||||
message:
|
||||
"Creating DAG of workflow."
|
||||
output:
|
||||
dot=RESOURCES + "dag.dot",
|
||||
pdf=RESOURCES + "dag.pdf",
|
||||
png=RESOURCES + "dag.png"
|
||||
conda: "envs/environment.yaml"
|
||||
png=RESOURCES + "dag.png",
|
||||
conda:
|
||||
"envs/environment.yaml"
|
||||
shell:
|
||||
"""
|
||||
snakemake --rulegraph all | sed -n "/digraph/,\$p" > {output.dot}
|
||||
dot -Tpdf -o {output.pdf} {output.dot}
|
||||
dot -Tpng -o {output.png} {output.dot}
|
||||
"""
|
||||
"""
|
||||
|
@ -2,6 +2,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
|
||||
def memory(w):
|
||||
factor = 3.0
|
||||
for o in w.opts.split("-"):
|
||||
@ -37,4 +38,4 @@ def solved_previous_horizon(wildcards):
|
||||
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_"
|
||||
+ planning_horizon_p
|
||||
+ ".nc"
|
||||
)
|
||||
)
|
||||
|
@ -24,7 +24,8 @@ rule plot_network:
|
||||
mem_mb=10000,
|
||||
benchmark:
|
||||
(
|
||||
BENCHMARKS + "plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
BENCHMARKS
|
||||
+ "plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
)
|
||||
conda:
|
||||
"../envs/environment.yaml"
|
||||
@ -55,7 +56,7 @@ rule copy_conda_env:
|
||||
resources:
|
||||
mem_mb=500,
|
||||
log:
|
||||
LOGS + "copy_conda_env.log"
|
||||
LOGS + "copy_conda_env.log",
|
||||
benchmark:
|
||||
BENCHMARKS + "copy_conda_env"
|
||||
conda:
|
||||
@ -102,7 +103,7 @@ rule make_summary:
|
||||
resources:
|
||||
mem_mb=10000,
|
||||
log:
|
||||
LOGS + "make_summary.log"
|
||||
LOGS + "make_summary.log",
|
||||
benchmark:
|
||||
BENCHMARKS + "make_summary"
|
||||
conda:
|
||||
@ -128,7 +129,7 @@ rule plot_summary:
|
||||
resources:
|
||||
mem_mb=10000,
|
||||
log:
|
||||
LOGS + "plot_summary.log"
|
||||
LOGS + "plot_summary.log",
|
||||
benchmark:
|
||||
BENCHMARKS + "plot_summary"
|
||||
conda:
|
||||
|
@ -85,7 +85,7 @@ if config["enable"].get("retrieve_natura_raster", True):
|
||||
output:
|
||||
RESOURCES + "natura.tiff",
|
||||
log:
|
||||
LOGS + "retrieve_natura_raster.log"
|
||||
LOGS + "retrieve_natura_raster.log",
|
||||
resources:
|
||||
mem_mb=5000,
|
||||
retries: 2
|
||||
@ -168,7 +168,7 @@ rule retrieve_ship_raster:
|
||||
output:
|
||||
"data/shipdensity_global.zip",
|
||||
log:
|
||||
LOGS + "retrieve_ship_raster.log"
|
||||
LOGS + "retrieve_ship_raster.log",
|
||||
resources:
|
||||
mem_mb=5000,
|
||||
retries: 2
|
||||
|
@ -29,10 +29,12 @@ rule add_existing_baseyear:
|
||||
resources:
|
||||
mem_mb=2000,
|
||||
log:
|
||||
LOGS + "add_existing_baseyear_elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log"
|
||||
LOGS
|
||||
+ "add_existing_baseyear_elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log",
|
||||
benchmark:
|
||||
(
|
||||
BENCHMARKS + "add_existing_baseyear/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
BENCHMARKS
|
||||
+ "add_existing_baseyear/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
)
|
||||
conda:
|
||||
"../envs/environment.yaml"
|
||||
@ -56,10 +58,12 @@ rule add_brownfield:
|
||||
resources:
|
||||
mem_mb=10000,
|
||||
log:
|
||||
LOGS + "add_brownfield_elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log"
|
||||
LOGS
|
||||
+ "add_brownfield_elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log",
|
||||
benchmark:
|
||||
(
|
||||
BENCHMARKS + "add_brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
BENCHMARKS
|
||||
+ "add_brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
)
|
||||
conda:
|
||||
"../envs/environment.yaml"
|
||||
@ -94,7 +98,8 @@ rule solve_sector_network_myopic:
|
||||
mem_mb=config["solving"]["mem"],
|
||||
benchmark:
|
||||
(
|
||||
BENCHMARKS + "solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
BENCHMARKS
|
||||
+ "solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
)
|
||||
conda:
|
||||
"../envs/environment.yaml"
|
||||
|
@ -29,7 +29,8 @@ rule solve_sector_network:
|
||||
benchmark:
|
||||
(
|
||||
RESULTS
|
||||
+ BENCHMARKS + "solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
+ BENCHMARKS
|
||||
+ "solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
||||
)
|
||||
conda:
|
||||
"../envs/environment.yaml"
|
||||
|
Loading…
Reference in New Issue
Block a user