run: name: all will collect all keys from scenarios.yaml if run: scenarios: enable: true
This commit is contained in:
parent
20e37c232f
commit
67acbbda8a
16
Snakefile
16
Snakefile
@ -10,7 +10,6 @@ import yaml
|
||||
from snakemake.remote.HTTP import RemoteProvider as HTTPRemoteProvider
|
||||
from snakemake.utils import min_version
|
||||
|
||||
# TODO: check if this works with mock_snakemake
|
||||
from scripts._helpers import path_provider
|
||||
|
||||
min_version("7.7")
|
||||
@ -32,13 +31,14 @@ configfile: "config/config.yaml"
|
||||
|
||||
run = config["run"]
|
||||
scenarios = run.get("scenarios", {})
|
||||
if run["name"]:
|
||||
if scenarios.get("enable"):
|
||||
fn = Path(scenarios["file"])
|
||||
scenarios = yaml.safe_load(fn.read_text())
|
||||
RDIR = "{run}/"
|
||||
else:
|
||||
RDIR = run["name"] + "/"
|
||||
if run["name"] and scenarios.get("enable"):
|
||||
fn = Path(scenarios["file"])
|
||||
scenarios = yaml.safe_load(fn.read_text())
|
||||
RDIR = "{run}/"
|
||||
if run["name"] == "all":
|
||||
config["run"]["name"] = list(scenarios.keys())
|
||||
elif run["name"]:
|
||||
RDIR = run["name"] + "/"
|
||||
else:
|
||||
RDIR = ""
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
,Unit,Values,Description
|
||||
name,--,str/list,"Specify a name for your run. Results will be stored under this name. If ``scenario: enable`` is set to ``true``, the name must contain a subset of scenario names defined in ``scenario: file``."
|
||||
name,--,str/list,"Specify a name for your run. Results will be stored under this name. If ``scenario: enable:`` is set to ``true``, the name must contain a subset of scenario names defined in ``scenario: file:``. If the name is 'all', all defined scenarios will be run."
|
||||
scenarios,,,
|
||||
-- enable,bool,"{true, false}","Switch to select whether workflow should generate scenarios based on ``file``."
|
||||
-- file,str,,"Path to the scenario yaml file. The scenario file contains config overrides for each scenario. In order to be taken account, ``run: scenarios`` has to be set to ``true`` and ``run: name`` has to be a subset of top level keys given in the scenario file. In order to automatically create a `scenario.yaml` file based on a combination of settings, alter and use the ``config/create_scenarios.py`` script in the ``config`` directory."
|
||||
disable_progrssbar,bool,"{true, false}","Switch to select whether progressbar should be disabled."
|
||||
disable_progressbar,bool,"{true, false}","Switch to select whether progressbar should be disabled."
|
||||
shared_resources,bool/str,,"Switch to select whether resources should be shared across runs. If a string is passed, this is used as a subdirectory name for shared resources. If set to 'base', only resources before creating the elec.nc file are shared."
|
||||
shared_cutouts,bool,"{true, false}","Switch to select whether cutouts should be shared across runs."
|
||||
|
|
Loading…
Reference in New Issue
Block a user