Skip to content

Commit

Permalink
Logging breakdown used in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniekmateusz committed Feb 14, 2025
1 parent a5472cd commit 36e734c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ties/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def command_line_script():
# generate all pairings
pairs = [ties.pair.Pair(ligA, ligZ, config) for ligA, ligZ in itertools.combinations(ligands, r=2)]

config.logging_breakdown = True

# superimpose the paired topologies
for pair in pairs:
start_time = time.perf_counter()
Expand Down
2 changes: 1 addition & 1 deletion ties/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self, **kwargs):
self.set_configs(**kwargs)

# logging
self.logging_breakdown = True
self.logging_breakdown = False
self.logging_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
self.logging_level = logging.INFO

Expand Down
4 changes: 2 additions & 2 deletions ties/topology_superimposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3175,7 +3175,7 @@ def superimpose_topologies(top1_nodes,
- check if each molecule topology is connected
"""

if config.logging_breakdown:
if config is not None and config.logging_breakdown:
file_log_handler = logging.FileHandler(config.workdir / f'{logging_key}.log')
file_log_handler.setLevel(config.logging_level)
file_log_handler.setFormatter(config.logging_formatter)
Expand Down Expand Up @@ -3389,7 +3389,7 @@ def take_largest(x, y):
logger.info(f'Disappearing atoms: { (len(top1_nodes) - len(suptop.matched_pairs)) / len(top1_nodes) * 100:.1f}%')
logger.info(f'Appearing atoms: { (len(top2_nodes) - len(suptop.matched_pairs)) / len(top2_nodes) * 100:.1f}%')

if config.logging_breakdown:
if config is not None and config.logging_breakdown:
logger.removeHandler(file_log_handler)

return suptop
Expand Down

0 comments on commit 36e734c

Please # to comment.