Processor log warnings

Fix ambiguous log warnings

Change-Id: I3416b946c900f8569e51f4c8425d731286ff5354
This commit is contained in:
Idan Hefetz 2018-11-14 12:26:07 +00:00
parent 8573746e86
commit 4bba4573cf

View File

@ -96,17 +96,17 @@ class Processor(processor.ProcessorBase):
LOG.debug('Update entity in entity graph:\n%s', updated_vertex) LOG.debug('Update entity in entity graph:\n%s', updated_vertex)
graph_vertex = self.entity_graph.get_vertex(updated_vertex.vertex_id) graph_vertex = self.entity_graph.get_vertex(updated_vertex.vertex_id)
if graph_vertex and not PUtils.is_newer_vertex(graph_vertex,
if (not graph_vertex) or \ updated_vertex):
PUtils.is_newer_vertex(graph_vertex, updated_vertex): LOG.warning("Update event arrived later than expected - "
self._add_resource_details_to_alarm(updated_vertex, neighbors) "graph_vertex: %s --- updated_vertex: %s",
PUtils.update_entity_graph_vertex(self.entity_graph, graph_vertex, updated_vertex)
graph_vertex, return
updated_vertex) self._add_resource_details_to_alarm(updated_vertex, neighbors)
self._update_neighbors(updated_vertex, neighbors) PUtils.update_entity_graph_vertex(self.entity_graph,
else: graph_vertex,
LOG.warning("Update event arrived on invalid resource: %s", updated_vertex)
updated_vertex) self._update_neighbors(updated_vertex, neighbors)
def delete_entity(self, deleted_vertex, neighbors): def delete_entity(self, deleted_vertex, neighbors):
"""Deletes the vertex from the entity graph """Deletes the vertex from the entity graph
@ -124,24 +124,32 @@ class Processor(processor.ProcessorBase):
graph_vertex = self.entity_graph.get_vertex(deleted_vertex.vertex_id) graph_vertex = self.entity_graph.get_vertex(deleted_vertex.vertex_id)
if graph_vertex and (not PUtils.is_deleted(graph_vertex)) and \ if not graph_vertex:
PUtils.is_newer_vertex(graph_vertex, deleted_vertex): LOG.warning('Delete - vertex not found %s', deleted_vertex)
neighbor_vertices = self.entity_graph.neighbors( return
deleted_vertex.vertex_id) elif PUtils.is_deleted(graph_vertex):
neighbor_edges = self.entity_graph.get_edges( LOG.warning('Delete - vertex already deleted - '
deleted_vertex.vertex_id) "graph_vertex: %s --- deleted_vertex: %s",
graph_vertex, deleted_vertex)
return
elif not PUtils.is_newer_vertex(graph_vertex, deleted_vertex):
LOG.warning("Delete event arrived later than expected - "
"graph_vertex: %s --- deleted_vertex: %s",
graph_vertex, deleted_vertex)
return
for edge in neighbor_edges: neighbor_vertices = self.entity_graph.neighbors(
PUtils.mark_deleted(self.entity_graph, edge) deleted_vertex.vertex_id)
neighbor_edges = self.entity_graph.get_edges(
deleted_vertex.vertex_id)
for vertex in neighbor_vertices: for edge in neighbor_edges:
PUtils.delete_placeholder_vertex(self.entity_graph, vertex) PUtils.mark_deleted(self.entity_graph, edge)
PUtils.mark_deleted(self.entity_graph, deleted_vertex) for vertex in neighbor_vertices:
else: PUtils.delete_placeholder_vertex(self.entity_graph, vertex)
LOG.warning("Delete entity arrived on invalid resource: "
"deleted_vertex - %s, graph_vertex - %s", PUtils.mark_deleted(self.entity_graph, deleted_vertex)
deleted_vertex, graph_vertex)
def update_relationship(self, entity_vertex, neighbors): def update_relationship(self, entity_vertex, neighbors):
LOG.debug('Update relationship in entity graph:\n%s', neighbors) LOG.debug('Update relationship in entity graph:\n%s', neighbors)