Merge "bug fix for LOG"

This commit is contained in:
Jenkins 2016-02-22 16:08:34 +00:00 committed by Gerrit Code Review
commit a5c9ee3993
4 changed files with 12 additions and 12 deletions

View File

@ -44,8 +44,8 @@ class NXAlgorithm(GraphAlgorithm):
match_func = create_predicate(query_dict)
if not match_func(root_data):
LOG.info('graph_query_vertices: root ' + str(root_id) +
' does not match filter ' + str(query_dict) + ')')
LOG.info('graph_query_vertices: root %s does not match filter %s',
str(root_id), str(query_dict))
return None
n_result = []

View File

@ -16,9 +16,7 @@ import copy
import json
import networkx as nx
from networkx.readwrite import json_graph
from oslo_log import log as logging
from driver import Direction
@ -84,16 +82,15 @@ class NXGraph(Graph):
properties = self._g.node.get(v_id, None)
if properties is not None:
return vertex_copy(v_id, properties)
LOG.debug("get_vertex item not found. v_id=" + str(v_id))
LOG.debug("get_vertex item not found. v_id=%s", str(v_id))
return None
def get_edge(self, source_id, target_id, label):
try:
properties = self._g.adj[source_id][target_id][label]
except KeyError:
LOG.debug("get_edge item not found. source_id=" + str(source_id) +
", target_id=" + str(target_id) +
", label=" + str(label))
LOG.debug("get_edge item not found. source_id=%s, target_id=%s, "
"label=%s", str(source_id), str(target_id), str(label))
return None
if properties is not None:
return edge_copy(source_id, target_id, label, properties)

View File

@ -64,12 +64,14 @@ def create_predicate(query_dict):
"""
try:
expression = _create_query_expression(query=query_dict)
LOG.debug('create_predicate::', expression)
LOG.debug('create_predicate::%s', expression)
expression = 'lambda item: ' + expression
return eval(expression)
except Exception as e:
LOG.error('invalid query format', query_dict, e)
raise VitrageError('invalid query format', query_dict, e)
LOG.error('invalid query format %s. Exception: %s',
query_dict, e)
raise VitrageError('invalid query format %s. Exception: %s',
query_dict, e)
def _create_query_expression(query, parent_operator=None):

View File

@ -128,7 +128,8 @@ def sub_graph_matching(_graph_, sub_graph, known_matches):
initial_sg = create_initial_sub_graph(_graph_, known_matches, sub_graph)
if not initial_sg:
LOG.warning('sub_graph_matching: Initial sub-graph creation failed')
LOG.warning('sub_graph_matching: Known matches: ' + str(known_matches))
LOG.warning('sub_graph_matching: Known matches: %s',
str(known_matches))
return final_sub_graphs
_queue_ = [initial_sg]