Move yagi handler into winchester codebase.
This commit is contained in:
parent
a8f373e4bf
commit
c2aa498beb
4
setup.py
4
setup.py
|
@ -31,6 +31,8 @@ setup(
|
||||||
scripts=[],
|
scripts=[],
|
||||||
long_description=read('README.md'),
|
long_description=read('README.md'),
|
||||||
install_requires=install_reqs,
|
install_requires=install_reqs,
|
||||||
|
entry_points = {
|
||||||
|
'console_scripts': ['pipeline_worker=winchester.worker:main'],
|
||||||
|
},
|
||||||
zip_safe=False
|
zip_safe=False
|
||||||
)
|
)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue