Skip to content

Commit d4831ac

Browse files
committed
Write run time config to a file
This is generally useful for debugging and will be used by augur subsample. Note that while this is under the 'rules' folder, it is not a rule. Instead, it is top-level workflow code run before rules to ensure that the file is written on every workflow run, including dry runs.
1 parent a693638 commit d4831ac

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ We use this CHANGELOG to document breaking changes, new features, bug fixes, and
44

55
## 2025
66

7+
* 8 September 2025: Configuration resolved at run time is now written to a file under `results/run_configs`. [PR #102](https://github.com/nextstrain/WNV/pull/102) @victorlin
78
* 8 September 2025: The phylogenetic workflow configuration now expects a new structure with most configuration defined under a build-specific key. See `phylogenetic/defaults/config.yaml` as an example. **This is a breaking change.** [PR #102](https://github.com/nextstrain/WNV/pull/102) @victorlin
89
* 8 September 2025: The phylogenetic workflow now runs all Nextstrain-maintained builds by default. This can be adjusted by a new configuration option, `builds`. **This is a breaking change.** [PR #102](https://github.com/nextstrain/WNV/pull/102) @victorlin
910
* 8 September 2025: Support for manual subsampling by editing the file `phylogenetic/rules/subsampling_manual.smk` is no longer supported. **This is a breaking change.** [PR #102](https://github.com/nextstrain/WNV/pull/102) @victorlin

phylogenetic/Snakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ rule all:
5353
# custom_rules imported below to ensure that the core workflow is not complicated
5454
# by build specific rules.
5555

56+
include: "rules/write_config.smk"
5657
include: "rules/merge_additional_inputs.smk"
5758
include: "rules/prepare_sequences.smk"
5859
include: "rules/subsample.smk"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
This part of the workflow writes run time configuration to a YAML file.
3+
4+
OUTPUTS:
5+
6+
results/run_configs/{timestamp}.yaml
7+
"""
8+
import os
9+
import sys
10+
import yaml
11+
from datetime import datetime
12+
13+
timestamp = datetime.now().astimezone().strftime("%Y-%m-%dT%H%M%S.%f")
14+
path = f"results/run_configs/{timestamp}.yaml"
15+
16+
os.makedirs(os.path.dirname(path), exist_ok=True)
17+
18+
with open(path, 'w') as f:
19+
yaml.dump(config, f, sort_keys=False)
20+
21+
print(f"Saved current run config to {path!r}.", file=sys.stderr)

0 commit comments

Comments
 (0)