Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
cbb4d514
Commit
cbb4d514
authored
Apr 06, 2021
by
Herry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[semanticLinking] added log messages
parent
e690562c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
MessageHandler.py
...ntic-linking-microservice/app/messaging/MessageHandler.py
+12
-0
No files found.
src/data-hub/semantic-linking-microservice/app/messaging/MessageHandler.py
View file @
cbb4d514
...
@@ -54,15 +54,21 @@ class MessageHandler:
...
@@ -54,15 +54,21 @@ class MessageHandler:
layers
=
[
Layer
.
from_business_logic_dict
(
row
)
for
row
in
json
.
loads
(
response
.
text
)]
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
# update local DB, insert each layer that does not already exists
for
layer
in
layers
:
for
layer
in
layers
:
print
(
f
"Add layer to DB: {layer.to_serializable_dict(for_db=True)}"
)
print
(
f
"Add layer to DB: {layer.to_serializable_dict(for_db=True)}"
)
self
.
_repository
.
delete_layer
(
layer
)
self
.
_repository
.
delete_layer
(
layer
)
self
.
_repository
.
add_layer
(
layer
)
self
.
_repository
.
add_layer
(
layer
)
if
len
(
layers
)
==
0
:
LOGGER
.
error
(
f
"no schema information found"
)
return
layers
return
layers
def
handle_new_trace
(
self
,
content
:
Dict
):
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
:
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()})"
)
LOGGER
.
error
(
f
"Missing fields in trace, required fields: (use_case, id, properties, table), given fields: ({content.keys()})"
)
return
return
...
@@ -82,6 +88,7 @@ class MessageHandler:
...
@@ -82,6 +88,7 @@ class MessageHandler:
LOGGER
.
warning
(
f
"No layers available for '{use_case}'.'{table}', ignoring trace."
)
LOGGER
.
warning
(
f
"No layers available for '{use_case}'.'{table}', ignoring trace."
)
return
return
LOGGER
.
info
(
f
"{len(layers)} layers available"
)
nodes
=
[]
nodes
=
[]
for
layer
in
layers
:
for
layer
in
layers
:
...
@@ -97,7 +104,12 @@ class MessageHandler:
...
@@ -97,7 +104,12 @@ class MessageHandler:
nodes
.
append
(
node
)
nodes
.
append
(
node
)
if
len
(
nodes
)
>
0
:
if
len
(
nodes
)
>
0
:
LOGGER
.
info
(
f
"{len(layers)} layers available"
)
self
.
_repository
.
add_layer_nodes
(
nodes
)
self
.
_repository
.
add_layer_nodes
(
nodes
)
else
:
LOGGER
.
error
(
f
"did NOT add nodes..."
)
LOGGER
.
info
(
"done"
)
def
handle_new_traces_available
(
self
):
def
handle_new_traces_available
(
self
):
# get all traces and call the Processor
# get all traces and call the Processor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment