aboutsummaryrefslogtreecommitdiff
path: root/statustracker.py
blob: 9b465b81390a833911c4934d79a840a9b5c1601e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3

from builtins import object
import time
import logging

class StatusTracker(object):
    emailNotificationsAreWorking = False
    lastRunJob = 0
    def __init__(self, config):
        self.emailNotificationsAreWorking = False
        self.lastRunJob = 0
        self.config = config
        
    def isMailGood(self):
        return self.emailNotificationsAreWorking

    def isJobsGood(self):
        return time.time() - self.lastRunJob < 120

    def markJobRan(self):
        self.lastRunJob = time.time()

    def markEmailStatus(self, working):
        self.emailNotificationsAreWorking = working