Add logging to process_queue

This commit is contained in:
Peter J. Holzer 2022-12-27 11:44:03 +01:00 committed by Peter J. Holzer
parent 0fab037cbc
commit 851d9b4b37
1 changed files with 9 additions and 0 deletions

View File

@ -1,11 +1,19 @@
#!/usr/bin/python3 #!/usr/bin/python3
import logging
import logging.config
import os import os
import socket import socket
import time import time
from ltsdb_json import LTS from ltsdb_json import LTS
import config
logging.config.dictConfig(config.logging)
log = logging.getLogger("process_queue")
node = socket.gethostbyaddr(socket.gethostname())[0] node = socket.gethostbyaddr(socket.gethostname())[0]
class DiskFullPredictor: class DiskFullPredictor:
@ -40,6 +48,7 @@ class DiskFullPredictor:
if d[1] < current_usable_bytes * 0.1: if d[1] < current_usable_bytes * 0.1:
continue # for sanity continue # for sanity
if current_used_bytes ** 2 / d[1] > current_usable_bytes: if current_used_bytes ** 2 / d[1] > current_usable_bytes:
log.info("d = %s, current_used_bytes = %s, current_usable_bytes = %s", d, current_used_bytes, current_usable_bytes)
tuf = now - d[0] tuf = now - d[0]
break break
desc = {**lts.description, desc = {**lts.description,