Commit cbb4d514 authored by Herry's avatar Herry

[semanticLinking] added log messages

parent e690562c
......@@ -54,15 +54,21 @@ class MessageHandler:
layers = [Layer.from_business_logic_dict(row) for row in json.loads(response.text)]
LOGGER.info(f"Received {len(layers)} layers")
# update local DB, insert each layer that does not already exists
for layer in layers:
print(f"Add layer to DB: {layer.to_serializable_dict(for_db=True)}")
self._repository.delete_layer(layer)
self._repository.add_layer(layer)
if len(layers)==0:
LOGGER.error(f"no schema information found")
return layers
def handle_new_trace(self, content: Dict):
LOGGER.info("new trace!")
if "use_case" not in content or "id" not in content or "properties" not in content or "table" not in content:
LOGGER.error(f"Missing fields in trace, required fields: (use_case, id, properties, table), given fields: ({content.keys()})")
return
......@@ -82,6 +88,7 @@ class MessageHandler:
LOGGER.warning(f"No layers available for '{use_case}'.'{table}', ignoring trace.")
return
LOGGER.info(f"{len(layers)} layers available")
nodes = []
for layer in layers:
......@@ -97,7 +104,12 @@ class MessageHandler:
nodes.append(node)
if len(nodes) > 0:
LOGGER.info(f"{len(layers)} layers available")
self._repository.add_layer_nodes(nodes)
else:
LOGGER.error(f"did NOT add nodes...")
LOGGER.info("done")
def handle_new_traces_available(self):
# get all traces and call the Processor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment