bug fix for LOG
Change-Id: I0b46375f961b7d85e0c0518547b1c799cdc8c0ec
This commit is contained in:
parent
b83fe8c75d
commit
b5f584ccb2
@ -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 = []
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -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]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user