Skip to content

Commit 81f6365

Browse files
committed
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 81f6365

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

nextstrain/cli/command/run.py

Lines changed: 13 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,10 @@ def run(opts):
296305
*(["--configfile=%s" % (resolved_configfile)]
297306
if resolved_configfile else []),
298307

308+
# Ensure the overlay config in the user's analysis directory
309+
# overrides any default config file provided above.
310+
*(["--configfile=%s" % (resolved_overlay)]
311+
if resolved_overlay else []),
299312
# Pass thru appropriate resource options.
300313
#
301314
# Snakemake requires the --cores option as of 5.11, so provide a

0 commit comments

Comments
 (0)