only copy active configuration to results folder
use copy config for all solve rules remove copying of environment
This commit is contained in:
parent
319c18b0d4
commit
1bf6ea1532
@ -39,7 +39,7 @@ rule copy_config:
|
|||||||
params:
|
params:
|
||||||
RDIR=RDIR,
|
RDIR=RDIR,
|
||||||
output:
|
output:
|
||||||
RESULTS + "config/config.yaml",
|
RESULTS + "config.yaml",
|
||||||
threads: 1
|
threads: 1
|
||||||
resources:
|
resources:
|
||||||
mem_mb=1000,
|
mem_mb=1000,
|
||||||
@ -51,22 +51,6 @@ rule copy_config:
|
|||||||
"../scripts/copy_config.py"
|
"../scripts/copy_config.py"
|
||||||
|
|
||||||
|
|
||||||
rule copy_conda_env:
|
|
||||||
output:
|
|
||||||
RESULTS + "config/environment.yaml",
|
|
||||||
threads: 1
|
|
||||||
resources:
|
|
||||||
mem_mb=500,
|
|
||||||
log:
|
|
||||||
LOGS + "copy_conda_env.log",
|
|
||||||
benchmark:
|
|
||||||
BENCHMARKS + "copy_conda_env"
|
|
||||||
conda:
|
|
||||||
"../envs/environment.yaml"
|
|
||||||
shell:
|
|
||||||
"conda env export -f {output} --no-builds"
|
|
||||||
|
|
||||||
|
|
||||||
rule make_summary:
|
rule make_summary:
|
||||||
params:
|
params:
|
||||||
foresight=config["foresight"],
|
foresight=config["foresight"],
|
||||||
|
@ -13,6 +13,7 @@ rule solve_network:
|
|||||||
),
|
),
|
||||||
input:
|
input:
|
||||||
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
||||||
|
config=RESULTS + "config.yaml",
|
||||||
output:
|
output:
|
||||||
network=RESULTS + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
network=RESULTS + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
||||||
log:
|
log:
|
||||||
|
@ -92,7 +92,7 @@ rule solve_sector_network_myopic:
|
|||||||
network=RESULTS
|
network=RESULTS
|
||||||
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
||||||
costs="data/costs_{planning_horizons}.csv",
|
costs="data/costs_{planning_horizons}.csv",
|
||||||
config=RESULTS + "config/config.yaml",
|
config=RESULTS + "config.yaml",
|
||||||
output:
|
output:
|
||||||
RESULTS
|
RESULTS
|
||||||
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
||||||
|
@ -14,9 +14,7 @@ rule solve_sector_network:
|
|||||||
input:
|
input:
|
||||||
network=RESULTS
|
network=RESULTS
|
||||||
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
||||||
costs="data/costs_{}.csv".format(config["costs"]["year"]),
|
config=RESULTS + "config.yaml",
|
||||||
config=RESULTS + "config/config.yaml",
|
|
||||||
#env=RDIR + 'config/environment.yaml',
|
|
||||||
output:
|
output:
|
||||||
RESULTS
|
RESULTS
|
||||||
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
||||||
|
@ -11,25 +11,13 @@ from shutil import copy
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
files = {
|
|
||||||
"config/config.yaml": "config.yaml",
|
|
||||||
"Snakefile": "Snakefile",
|
|
||||||
"scripts/solve_network.py": "solve_network.py",
|
|
||||||
"scripts/prepare_sector_network.py": "prepare_sector_network.py",
|
|
||||||
}
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if "snakemake" not in globals():
|
if "snakemake" not in globals():
|
||||||
from _helpers import mock_snakemake
|
from _helpers import mock_snakemake
|
||||||
|
|
||||||
snakemake = mock_snakemake("copy_config")
|
snakemake = mock_snakemake("copy_config")
|
||||||
|
|
||||||
basepath = Path(f"results/{snakemake.params.RDIR}config/")
|
with open(snakemake.output[0], "w") as yaml_file:
|
||||||
|
|
||||||
for f, name in files.items():
|
|
||||||
copy(f, basepath / name)
|
|
||||||
|
|
||||||
with open(basepath / "config.snakemake.yaml", "w") as yaml_file:
|
|
||||||
yaml.dump(
|
yaml.dump(
|
||||||
snakemake.config,
|
snakemake.config,
|
||||||
yaml_file,
|
yaml_file,
|
||||||
|
Loading…
Reference in New Issue
Block a user