Example #1
0
    def housekeeping(expired_threshold: int = 2,
                     info_threshold: int = 12) -> None:
        expired, unshelved = db.housekeeping(expired_threshold, info_threshold)

        for (id, event, last_receive_id) in expired:
            history = History(id=last_receive_id,
                              event=event,
                              status='expired',
                              text='expired after timeout',
                              change_type='status',
                              update_time=datetime.utcnow())
            db.set_status(id,
                          'expired',
                          timeout=current_app.config['ALERT_TIMEOUT'],
                          history=history)

        for (id, event, last_receive_id) in unshelved:
            history = History(id=last_receive_id,
                              event=event,
                              status='open',
                              text='unshelved after timeout',
                              change_type='status',
                              update_time=datetime.utcnow())
            db.set_status(id,
                          'open',
                          timeout=current_app.config['ALERT_TIMEOUT'],
                          history=history)
Example #2
0
    def housekeeping(expired_threshold: int = 2, info_threshold: int = 12) -> None:
        now = datetime.utcnow()
        expired, unshelved = db.housekeeping(expired_threshold, info_threshold)

        for (id, event, last_receive_id) in expired:
            history = History(
                id=last_receive_id,
                event=event,
                status='expired',
                text='auto-expired after timeout',
                change_type='status',
                update_time=now,
                user=g.login
            )
            db.set_status(id, 'expired', timeout=current_app.config['ALERT_TIMEOUT'], update_time=now, history=history)

        for (id, event, last_receive_id) in unshelved:
            # as per ISA 18.2 recommendation 11.7.3 auto-unshelved alarms transition to open, not previous status
            history = History(
                id=last_receive_id,
                event=event,
                status='open',
                text='auto-unshelved after timeout',
                change_type='status',
                update_time=now,
                user=g.login
            )
            db.set_status(id, 'open', timeout=current_app.config['ALERT_TIMEOUT'], update_time=now, history=history)
Example #3
0
    def housekeeping(expired_threshold: int=2, info_threshold: int=12) -> None:
        now = datetime.utcnow()
        expired, unshelved = db.housekeeping(expired_threshold, info_threshold)

        for (id, event, last_receive_id) in expired:
            history = History(
                id=last_receive_id,
                event=event,
                status='expired',
                text='auto-expired after timeout',
                change_type='status',
                update_time=now,
                user=g.login
            )
            db.set_status(id, 'expired', timeout=current_app.config['ALERT_TIMEOUT'], update_time=now, history=history)

        for (id, event, last_receive_id) in unshelved:
            # as per ISA 18.2 recommendation 11.7.3 auto-unshelved alarms transition to open, not previous status
            history = History(
                id=last_receive_id,
                event=event,
                status='open',
                text='auto-unshelved after timeout',
                change_type='status',
                update_time=now,
                user=g.login
            )
            db.set_status(id, 'open', timeout=current_app.config['ALERT_TIMEOUT'], update_time=now, history=history)
Example #4
0
 def housekeeping(expired_threshold=2, info_threshold=12):
     for (id, event, last_receive_id) in db.housekeeping(expired_threshold, info_threshold):
         history = History(
             id=last_receive_id,
             event=event,
             status="expired",
             text="alert timeout status change",
             change_type="status",
             update_time=datetime.utcnow()
         )
         db.set_status(id, "expired", history)
Example #5
0
 def housekeeping(expired_threshold=2, info_threshold=12):
     for (id, event, last_receive_id) in db.housekeeping(expired_threshold, info_threshold):
         history = History(
             id=last_receive_id,
             event=event,
             status="expired",
             text="alert timeout status change",
             change_type="status",
             update_time=datetime.utcnow()
         )
         db.set_status(id, "expired", history)
Example #6
0
 def housekeeping(expired_threshold=2, info_threshold=12):
     for (id, event, status,
          last_receive_id) in db.housekeeping(expired_threshold,
                                              info_threshold):
         if status == 'open':
             text = 'unshelved after timeout'
         elif status == 'expired':
             text = 'expired after timeout'
         else:
             text = 'alert timeout status change'
         history = History(id=last_receive_id,
                           event=event,
                           status=status,
                           text=text,
                           change_type="status",
                           update_time=datetime.utcnow())
         db.set_status(id,
                       status,
                       timeout=current_app.config['ALERT_TIMEOUT'],
                       history=history)