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
cafae66d
Commit
cafae66d
authored
Sep 02, 2020
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
traceRetrieval: duplicate nodes are not entered into the db again
parent
3acc11bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
repository.py
...n/trace-retrieval-microservice/app/database/repository.py
+3
-1
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+4
-1
No files found.
src/transaction-hub-in/trace-retrieval-microservice/app/database/repository.py
View file @
cafae66d
...
@@ -27,13 +27,15 @@ class Repository(MongoRepositoryBase):
...
@@ -27,13 +27,15 @@ class Repository(MongoRepositoryBase):
reference
=
self
.
get_transaction_with_id
(
transaction
.
id
())
reference
=
self
.
get_transaction_with_id
(
transaction
.
id
())
if
reference
==
None
:
if
reference
==
None
:
super
()
.
insert_entry
(
self
.
_transaction_collection
,
transaction
.
to_serializable_dict
())
super
()
.
insert_entry
(
self
.
_transaction_collection
,
transaction
.
to_serializable_dict
())
else
:
raise
ValueError
(
f
"ID {transaction['UniqueID']} already exists"
)
def
all_transactions_for_use_case
(
self
,
use_case
:
str
)
->
List
[
Transaction
]:
def
all_transactions_for_use_case
(
self
,
use_case
:
str
)
->
List
[
Transaction
]:
result
=
super
()
.
get_entries
(
self
.
_transaction_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"use_case"
:
use_case
})
result
=
super
()
.
get_entries
(
self
.
_transaction_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"use_case"
:
use_case
})
return
[
Transaction
.
from_serializable_dict
(
row
)
for
row
in
list
(
result
)]
return
[
Transaction
.
from_serializable_dict
(
row
)
for
row
in
list
(
result
)]
def
get_transaction_with_id
(
self
,
unique_id
:
str
)
->
Transaction
:
def
get_transaction_with_id
(
self
,
unique_id
:
str
)
->
Transaction
:
result
=
list
(
super
()
.
get_entries
(
self
.
_transaction_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"
id
"
:
unique_id
}))
result
=
list
(
super
()
.
get_entries
(
self
.
_transaction_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"
UniqueID
"
:
unique_id
}))
if
len
(
result
)
==
1
:
if
len
(
result
)
==
1
:
return
Transaction
.
from_serializable_dict
(
result
[
0
])
return
Transaction
.
from_serializable_dict
(
result
[
0
])
...
...
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
cafae66d
...
@@ -167,7 +167,10 @@ class MessageHandler:
...
@@ -167,7 +167,10 @@ class MessageHandler:
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
transaction
=
Transaction
(
use_case
,
flattened
)
transaction
=
Transaction
(
use_case
,
flattened
)
self
.
_mongo_repo
.
add_transaction
(
transaction
)
try
:
self
.
_mongo_repo
.
add_transaction
(
transaction
)
except
ValueError
as
e
:
LOGGER
.
error
(
f
"{e}, ignoring node"
)
msg
=
{
msg
=
{
"type"
:
"new-trace"
,
"type"
:
"new-trace"
,
...
...
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