Tested with PostgreSQL and moved PeerJobLogger into its own file

This commit is contained in:
Donald Zou
2025-05-13 21:36:15 +08:00
parent c6fc741aa8
commit 390cfa0cdf
4 changed files with 209 additions and 249 deletions

View File

@@ -1,14 +1,12 @@
"""
Peer Job Logger
"""
import os, uuid
import uuid
import sqlalchemy as db
from .Log import Log
from datetime import datetime
from sqlalchemy_utils import database_exists, create_database
class PeerJobLogger:
def __init__(self, CONFIGURATION_PATH, AllPeerJobs, DashboardConfig):
def __init__(self, AllPeerJobs, DashboardConfig):
self.engine = db.create_engine(DashboardConfig.getConnectionString("wgdashboard_log"))
self.metadata = db.MetaData()
self.jobLogTable = db.Table('JobLog', self.metadata,
@@ -40,7 +38,7 @@ class PeerJobLogger:
return False
return True
def getLogs(self, all: bool = False, configName = None) -> list[Log]:
def getLogs(self, configName = None) -> list[Log]:
logs: list[Log] = []
try:
allJobs = self.AllPeerJobs.getAllJobs(configName)