Skip to content

Instantly share code, notes, and snippets.

import inspect
import json
import os
import sys
from snakemake.resources import parse_resources
# Required for this file to be loaded by snakemake.main() as a --log-handler-script.
def log_handler(msg):
pass
import os
from contextlib import contextmanager
from time import sleep, time
@contextmanager
def Lockfile(path, timeout = 5 * 60):
started = time()
while (time() - started) < timeout:
try:

Run as

snakemake all_c

and you'll get this:

$ tree
.
├── a

│   ├── orange

Last two "remind to promote" runs, reverse chronological.
Note that because the state includes a relative duration, `releasedAgo`, we
fail to produce a reproducible hash. Whoops!
<https://github.com/nextstrain/nextstrain.org/actions/runs/3941437674/jobs/6743841749>
Cache restored from key: remind-to-promote-state-hash-3940925583
{
"config": {
"pipeline": "38f67fc7-d93c-40c6-a182-501da2f89d9d",
# Symlink the raw HID device (not the baked HID device) of a Thing blink(1),
# aka USB vendor:product id 27b8:01ed (cute product id!), using its reported
# serial number as /dev/blink/$serial. Also set the mode and group to allow
# access.
#
# This rule matches properties of two udev devices in the device tree:
#
# 1. the raw HID device with the SUBSYSTEM condition, and
# 2. the USB parent device (but *not* the baked HID device in between) with
# all the other conditions.
# vim: set ft=sh :
__BASHDB_SOURCE="$BASH_SOURCE"
__bashdb:trap() {
local file="$1" line="$2" fn="$3" cmd="$4"
echo "→ $file:$line:$fn: $cmd" >&2
# From here we can return:
# 0 to continue
rule tree:
message: "Building tree"
input:
alignment = rules.align.output.alignment
output:
tree = "results/tree_raw.nwk"
shell:
"""
# Remove any prior RAxML outputs which didn't get cleaned up
rm -v RAxML_*.* 2>/dev/null || true
# XXX TODO: Since Singularity normally supports local paths to image files
# or directories, it's possible someone might try to pass that. We're
# treating those as Docker image names unqualified by docker://, which may
# cause confusion. Doing:
#
# assert url.scheme or not Path(url.path).exists()
#
# might help… or it might cause false positives and different confusion.
# Let's not for now and wait and see.
# -trs, 5 Jan 2023
@tsibley
tsibley / escaping.diff
Last active January 5, 2023 00:11
escaping.diff
diff --git a/augur/tree.py b/augur/tree.py
index 820e653f..462e6135 100644
--- a/augur/tree.py
+++ b/augur/tree.py
@@ -3,6 +3,7 @@ Build a tree using a variety of methods.
"""
import os
+import re
import shlex
"""
Build a tree using a variety of methods.
"""
import os
import re
import shlex
import shutil
import sys
import time