diff --git a/vitrage/graph/networkx_algorithm.py b/vitrage/graph/networkx_algorithm.py index c02ec6357..d72c244ab 100644 --- a/vitrage/graph/networkx_algorithm.py +++ b/vitrage/graph/networkx_algorithm.py @@ -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 = [] diff --git a/vitrage/graph/networkx_graph.py b/vitrage/graph/networkx_graph.py index a2d39cbd6..de2582d16 100644 --- a/vitrage/graph/networkx_graph.py +++ b/vitrage/graph/networkx_graph.py @@ -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) diff --git a/vitrage/graph/query.py b/vitrage/graph/query.py index 9020deda2..3e0f7a02f 100644 --- a/vitrage/graph/query.py +++ b/vitrage/graph/query.py @@ -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): diff --git a/vitrage/graph/sub_graph_matching.py b/vitrage/graph/sub_graph_matching.py index cf3084959..f1c2d0e77 100644 --- a/vitrage/graph/sub_graph_matching.py +++ b/vitrage/graph/sub_graph_matching.py @@ -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]