Skip to content

Commit b14e591

Browse files
committed
WIP: run: ensure <analysis_directory>/config.yaml overrides workflow config
Because of the order in which Snakemake merges configs, we must also provide the user's config from their analysis directory to override workflow configs provided via the `--configfile` option. See detailed discussion in <#462 (comment)>
1 parent 529cf32 commit b14e591

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

nextstrain/cli/command/run.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,15 @@ def run(opts):
267267
if workflow_configfile:
268268
resolved_configfile = resolved_pathogen / workflow_configfile.relative_to(pathogen.path)
269269

270+
resolved_overlay = None
271+
if (opts.analysis_directory / "config.yaml").is_file():
272+
resolved_build = (
273+
docker.mount_point(build_volume)
274+
if opts.__runner__ in {docker, singularity, aws_batch} else
275+
build_volume.src.resolve(strict = True)
276+
)
277+
resolved_overlay = resolved_build / "config.yaml"
278+
270279
print(f"Running the {opts.workflow!r} workflow for pathogen {pathogen}")
271280

272281
# Set up Snakemake invocation.
@@ -296,6 +305,8 @@ def run(opts):
296305
*(["--configfile=%s" % (resolved_configfile)]
297306
if resolved_configfile else []),
298307

308+
*(["--configfile=%s" % (resolved_overlay)]
309+
if resolved_overlay else []),
299310
# Pass thru appropriate resource options.
300311
#
301312
# Snakemake requires the --cores option as of 5.11, so provide a

0 commit comments

Comments
 (0)