Skip to content
Permalink
Browse files
fix: handle config file extension/overwriting more explicitly (#1251)
* handle config file extension/overwriting more explicitly

* fmt
  • Loading branch information
johanneskoester committed Nov 17, 2021
1 parent b571e09 commit d0a7bf243c5df204136fa1f14706aab793793c68
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
@@ -1239,7 +1239,9 @@ def get_argument_parser(profile=None):
"Specify or overwrite the config file of the workflow (see the docs). "
"Values specified in JSON or YAML format are available in the global config "
"dictionary inside the workflow. Multiple files overwrite each other in "
"the given order."
"the given order. Thereby missing keys in previous config files are extended by "
"following configfiles. Note that this order also includes a config file defined "
"in the workflow definition itself (which will come first)."
),
)
group_exec.add_argument(
@@ -1238,10 +1238,23 @@ def configfile(self, fp):
"""Update the global config with data from the given file."""
global config
if not self.modifier.skip_configfile:
self.configfiles.append(fp)
c = snakemake.io.load_configfile(fp)
update_config(config, c)
update_config(config, self.overwrite_config)
if os.path.exists(fp):
self.configfiles.append(fp)
c = snakemake.io.load_configfile(fp)
update_config(config, c)
if self.overwrite_config:
logger.info(
"Config file {} is extended by additional config specified via the command line.".format(
fp
)
)
update_config(config, self.overwrite_config)
elif not self.overwrite_configfiles:
raise WorkflowError(
"Workflow defines configfile {} but it is not present or accessible.".format(
fp
)
)

def pepfile(self, path):
global pep

0 comments on commit d0a7bf2

Please sign in to comment.