forked from brownzach125/reviewboardbots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (26 loc) · 764 Bytes
/
main.py
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
26
27
28
29
30
31
32
33
34
#import json
import yaml
import logging
import os
import threading
import config
from botmanager import BotManager
from watcher import Watcher
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
class Service:
def __init__(self):
self.bot_manager = BotManager()
self.watcher = Watcher(self.bot_manager)
self.watcher_thread = None
def start(self):
print "Service: Start"
self.watcher_thread = threading.Thread(target=self.watcher.watch)
self.watcher_thread.start()
self.bot_manager.start()
def stop(self):
print "Service: Stop"
self.watcher.stop()
self.bot_manager.stop()
self.watcher_thread = None
service = Service()
service.start()