mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-12-16 00:16:18 +00:00
Fixed stale job issue
This commit is contained in:
@@ -2,8 +2,12 @@
|
||||
Peer Job Logger
|
||||
"""
|
||||
import uuid
|
||||
from typing import Sequence
|
||||
|
||||
import sqlalchemy as db
|
||||
from flask import current_app
|
||||
from sqlalchemy import RowMapping
|
||||
|
||||
from .ConnectionString import ConnectionString
|
||||
from .Log import Log
|
||||
|
||||
@@ -56,4 +60,21 @@ class PeerJobLogger:
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Getting Peer Job Log Error", e)
|
||||
return logs
|
||||
return logs
|
||||
return logs
|
||||
|
||||
def getFailingJobs(self) -> Sequence[RowMapping]:
|
||||
with self.engine.connect() as conn:
|
||||
table = conn.execute(
|
||||
db.select(
|
||||
self.jobLogTable.c.JobID
|
||||
).where(
|
||||
self.jobLogTable.c.Status == 'false'
|
||||
).group_by(
|
||||
self.jobLogTable.c.JobID
|
||||
).having(
|
||||
db.func.count(
|
||||
self.jobLogTable.c.JobID
|
||||
) > 10
|
||||
)
|
||||
).mappings().fetchall()
|
||||
return table
|
||||
Reference in New Issue
Block a user