Skip to content

Commit

Permalink
Add workaround for snakemake logging bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lczech committed Jul 17, 2024
1 parent 261a9a8 commit 61a291c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions workflow/rules/initialize.smk
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,27 @@ import os, sys, pwd, re
import socket, platform
import subprocess
from datetime import datetime
import logging

# Ensure min Snakemake version
snakemake.utils.min_version("8.15.2")
basedir = workflow.basedir

# We are currently setting up our own extra log file, so that the below banner is shown.
# Snakemake currently only activates logging to the `.snakemake/log` files _after_ having
# processed all snakefiles, which is not really how logging should work...
# See https://github.com/snakemake/snakemake/issues/2974 for the issue.
os.makedirs(os.path.join("logs", "snakemake"), exist_ok=True)
extra_logfile = os.path.abspath(
os.path.join(
"logs",
"snakemake",
datetime.now().isoformat().replace(":", "") + ".log",
)
)
logger.logger.addHandler(logging.FileHandler(extra_logfile))


# =================================================================================================
# Basic Configuration
# =================================================================================================
Expand Down

0 comments on commit 61a291c

Please sign in to comment.