1. code integration of Synchronizer + Processor + transformer
2. Create Entity graph service + Synchronizer service Change-Id: If1f09506f70298e975a47c8dd638b5cfcf438cb4 Implements: blueprint vitrage-resource-processor
This commit is contained in:
parent
2b6ae4ed01
commit
d9efb586e0
@ -9,7 +9,8 @@ python-novaclient>=2.26.0
|
||||
networkx>=1.10
|
||||
oslo.log>=1.12.0 # Apache-2.0
|
||||
oslo.policy>=0.3.0
|
||||
oslo.service>=0.1.0 # Apache-2.0
|
||||
oslo.service>=1.0.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0
|
||||
pecan>=0.8.0
|
||||
PasteDeploy>=1.5.0
|
||||
Werkzeug>=0.7
|
||||
|
@ -24,7 +24,7 @@ setup-hooks =
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
vitrage-api = vitrage.cmd.api:main
|
||||
vitrage-entity-graph = vitrage.cmd.graph:entity_graph
|
||||
vitrage-entity-graph = vitrage.cmd.graph:main
|
||||
|
||||
oslo.config.opts =
|
||||
vitrage = vitrage.opts:list_opts
|
||||
|
@ -13,7 +13,8 @@ sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
oslo.log>=1.12.0 # Apache-2.0
|
||||
oslosphinx>=2.5.0 # Apache-2.0
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
oslo.service>=0.1.0 # Apache-2.0
|
||||
oslo.service>=1.0.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0
|
||||
testrepository>=0.0.18
|
||||
testscenarios>=0.4
|
||||
testtools>=1.4.0
|
||||
|
@ -12,13 +12,27 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import multiprocessing
|
||||
|
||||
from oslo_service import service as os_service
|
||||
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage import entity_graph as entity_graph_svc
|
||||
from vitrage import service
|
||||
from vitrage import synchronizer as synchronizer_svc
|
||||
|
||||
|
||||
def entity_graph():
|
||||
def main():
|
||||
event_queue = multiprocessing.Queue()
|
||||
conf = service.prepare_service()
|
||||
os_service.launch(conf,
|
||||
entity_graph_svc.VitrageEntityGraphService(conf)).wait()
|
||||
launcher = os_service.ProcessLauncher(conf)
|
||||
|
||||
launcher.launch_service(entity_graph_svc.VitrageEntityGraphService(
|
||||
event_queue), workers=1)
|
||||
|
||||
synchronizer = synchronizer_svc.VitrageSynchronizerService(event_queue)
|
||||
launcher.launch_service(synchronizer, workers=1)
|
||||
|
||||
synchronizer.get_all(sync_mode=SyncMode.INIT_SNAPSHOT)
|
||||
|
||||
launcher.wait()
|
||||
|
@ -12,4 +12,39 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
__author__ = 'stack'
|
||||
from oslo_log import log
|
||||
from oslo_service import service as os_service
|
||||
|
||||
from vitrage.entity_graph.processor import processor as proc
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class VitrageEntityGraphService(os_service.Service):
|
||||
|
||||
def __init__(self, event_queue):
|
||||
super(VitrageEntityGraphService, self).__init__()
|
||||
self.queue = event_queue
|
||||
self.processor = proc.Processor()
|
||||
|
||||
def start(self):
|
||||
LOG.info("Start VitrageEntityGraphService")
|
||||
|
||||
super(VitrageEntityGraphService, self).start()
|
||||
|
||||
# while True:
|
||||
# event = self.queue.get()
|
||||
# self.processor.process_event(event)
|
||||
|
||||
LOG.info("Finish start VitrageEntityGraphService")
|
||||
|
||||
# Add a dummy thread to have wait() working
|
||||
# self.tg.add_timer(604800, lambda: None)
|
||||
|
||||
def stop(self):
|
||||
LOG.info("Stop VitrageEntityGraphService")
|
||||
|
||||
super(VitrageEntityGraphService, self).stop()
|
||||
|
||||
LOG.info("Finish stop VitrageEntityGraphService")
|
||||
|
@ -12,28 +12,4 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
# from oslo_service import service as os_service
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
# class VitrageEntityGraphService(os_service.Service):
|
||||
class VitrageEntityGraphService(object):
|
||||
|
||||
def __init__(self):
|
||||
super(VitrageEntityGraphService, self).__init__()
|
||||
|
||||
def start(self):
|
||||
LOG.info("Start ProcessorService")
|
||||
super(VitrageEntityGraphService, self).start()
|
||||
|
||||
LOG.info("Finish start ProcessorService")
|
||||
|
||||
def stop(self):
|
||||
LOG.info("Stop ProcessorService")
|
||||
|
||||
super(VitrageEntityGraphService, self).stop()
|
||||
LOG.info("Finish stop ProcessorService")
|
||||
__author__ = 'stack'
|
||||
|
@ -44,6 +44,7 @@ class Processor(processor.ProcessorBase):
|
||||
"""
|
||||
|
||||
entity = self.transform_entity(event)
|
||||
# TODO(Alexey): need to check here the NOT_RELEVANT action as well
|
||||
return self.actions[entity.action](entity.vertex, entity.neighbors)
|
||||
|
||||
def create_entity(self, new_vertex, neighbors):
|
||||
|
@ -0,0 +1,43 @@
|
||||
# Copyright 2015 - Alcatel-Lucent
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_service import service as os_service
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class VitrageSynchronizerService(os_service.Service):
|
||||
|
||||
def __init__(self, event_queue):
|
||||
super(VitrageSynchronizerService, self).__init__()
|
||||
self.queue = event_queue
|
||||
|
||||
def start(self):
|
||||
LOG.info("Start VitrageSynchronizerService")
|
||||
|
||||
super(VitrageSynchronizerService, self).start()
|
||||
|
||||
LOG.info("Finish start VitrageSynchronizerService")
|
||||
|
||||
# Add a dummy thread to have wait() working
|
||||
# self.tg.add_timer(604800, lambda: None)
|
||||
|
||||
def stop(self):
|
||||
LOG.info("Stop VitrageSynchronizerService")
|
||||
|
||||
super(VitrageSynchronizerService, self).stop()
|
||||
|
||||
LOG.info("Finish stop VitrageSynchronizerService")
|
Loading…
Reference in New Issue
Block a user