Move yagi handler into winchester codebase.

This commit is contained in:
Monsyne Dragon 2014-09-04 18:05:19 +00:00
parent a8f373e4bf
commit c2aa498beb
2 changed files with 33 additions and 1 deletions

View File

@ -31,6 +31,8 @@ setup(
scripts=[],
long_description=read('README.md'),
install_requires=install_reqs,
entry_points = {
'console_scripts': ['pipeline_worker=winchester.worker:main'],
},
zip_safe=False
)

View File

@ -0,0 +1,30 @@
import logging
from yagi.handler import BaseHandler
import yagi.config
from winchester.trigger_manager import TriggerManager
from winchester.config import ConfigManager
logger = logging.getLogger(__name__)
with yagi.config.defaults_for('winchester') as default:
default("config_file", "winchester.yaml")
class WinchesterHandler(BaseHandler):
CONFIG_SECTION = "winchester"
AUTO_ACK = True
def __init__(self, app=None, queue_name=None):
super(WinchesterHandler, self).__init__(app=app, queue_name=queue_name)
conf_file = self.config_get("config_file")
config = ConfigManager.load_config_file(conf_file)
self.trigger_manager = TriggerManager(config)
def handle_messages(self, messages, env):
for notification in self.iterate_payloads(messages, env):
self.trigger_manager.add_notification(notification)