Faster properties hashing
Change-Id: I27fe73b4a56c658a509fffdfe7af3cc68149057c
This commit is contained in:
parent
8fa4d751e4
commit
6d6c457e27
@ -16,10 +16,6 @@ from dateutil import parser
|
|||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from pprint import pformat
|
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from vitrage.common.constants import EdgeProperties as EProps
|
from vitrage.common.constants import EdgeProperties as EProps
|
||||||
from vitrage.common.constants import EntityCategory
|
from vitrage.common.constants import EntityCategory
|
||||||
from vitrage.common.constants import VertexProperties as VProps
|
from vitrage.common.constants import VertexProperties as VProps
|
||||||
@ -89,18 +85,12 @@ def get_vertex_types(vertex):
|
|||||||
|
|
||||||
|
|
||||||
def get_defining_properties(vertex):
|
def get_defining_properties(vertex):
|
||||||
defining_props = {VProps.TYPE: six.text_type(vertex[VProps.TYPE])}
|
if vertex.get(VProps.CATEGORY) == EntityCategory.ALARM:
|
||||||
|
dp = (vertex.get(VProps.TYPE), vertex.get(VProps.ID),
|
||||||
if VProps.ID in vertex.properties:
|
vertex.get(VProps.RESOURCE_ID), vertex.get(VProps.NAME))
|
||||||
defining_props[VProps.ID] = vertex[VProps.ID]
|
else:
|
||||||
|
dp = (vertex.get(VProps.TYPE), vertex.get(VProps.ID))
|
||||||
# In case the entity is an Alarm
|
return hash(dp)
|
||||||
if vertex[VProps.CATEGORY] == EntityCategory.ALARM:
|
|
||||||
if VProps.RESOURCE_ID in vertex.properties:
|
|
||||||
defining_props[VProps.RESOURCE_ID] = vertex[VProps.RESOURCE_ID]
|
|
||||||
defining_props[VProps.NAME] = vertex[VProps.NAME]
|
|
||||||
|
|
||||||
return hash(pformat(defining_props))
|
|
||||||
|
|
||||||
|
|
||||||
def can_update_vertex(graph_vertex, new_vertex):
|
def can_update_vertex(graph_vertex, new_vertex):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user