snakemake gives all messages twice

72 Views Asked by At

Snakemake is giving me a lot of extra warnings and info, many of them twice. How do I turn this behaviour off?

See screen shot below: enter image description here

Now with reprex

I've been able to track the source of the problem down, and bottled it up into a minimum working example. Try running this snakefile:

from pyesgf.search import SearchConnection

people = ['Amy', 'Bruce']

rule person:
    output: '{person}.txt'
    run:
        print(f'\n This person is called {wildcards.person}!\n')

rule people:
    input: expand('{person}.txt',person=people)

With the import present, the extra logging messages are present. Commenting it out gets rid of it.

Versions:

  • esgf-pyclient=0.3.1=pyh1a96a4e_2
  • snakemake=7.32.4=hdfd78af_0
1

There are 1 best solutions below

0
On BEST ANSWER

This is from esgf-pyclient's logging code which adds another handler to the logger. When snakemake logs some output it gets handled twice, once by esgf (lines like WARNING:snakemake...) and once by snakemake (lines like Building DAG of jobs with color).

There's an argument that snakemake should disallow other loggers, but it's equally useful if a module has important logging information. Either way, it seems like you can:

import logging
logging.getLogger('pyesgf.search').disabled = True

after you import pyesgf. I didn't test this so the name may not be correct.