2018-07-13 14:51:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2018-04-10 00:20:59 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import logging
|
|
|
|
from bgpranking.abstractmanager import AbstractManager
|
|
|
|
from bgpranking.ranking import Ranking
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
|
|
|
|
level=logging.INFO, datefmt='%I:%M:%S')
|
|
|
|
|
|
|
|
|
|
|
|
class RankingManager(AbstractManager):
|
|
|
|
|
2018-04-10 01:46:38 +02:00
|
|
|
def __init__(self, config_dir: Path=None, loglevel: int=logging.INFO):
|
2018-04-10 00:20:59 +02:00
|
|
|
super().__init__(loglevel)
|
|
|
|
self.ranking = Ranking(config_dir, loglevel)
|
|
|
|
|
|
|
|
def _to_run_forever(self):
|
|
|
|
self.ranking.compute()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
dbinsert = RankingManager()
|
|
|
|
dbinsert.run(sleep_in_sec=3600)
|