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
c793e6df
Commit
c793e6df
authored
Nov 03, 2020
by
Bogdan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Duplicated Traces Functionality
parent
383b7388
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
repository.py
...n/trace-retrieval-microservice/app/database/repository.py
+13
-0
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+10
-0
No files found.
src/transaction-hub-in/trace-retrieval-microservice/app/database/repository.py
View file @
c793e6df
...
...
@@ -18,6 +18,7 @@ class Repository(MongoRepositoryBase):
self
.
_transaction_collection
=
'transactions'
self
.
_failed_transaction_collection
=
'transactions_failed'
self
.
_duplicated_transactioN_collection
=
"transactions_duplicated"
def
delete_all_transactions
(
self
):
collection
=
self
.
_database
[
self
.
_transaction_collection
]
...
...
@@ -57,4 +58,16 @@ class Repository(MongoRepositoryBase):
def
delete_all_failed_transactions
(
self
,
use_case
:
str
):
collection
=
self
.
_database
[
self
.
_failed_transaction_collection
]
collection
.
delete_many
({
"ApplicationType"
:
use_case
})
def
add_duplicated_transaction
(
self
,
transaction
:
Transaction
):
#transaction["timestamp"] = time.time()
super
()
.
insert_entry
(
self
.
_duplicated_transactioN_collection
,
transaction
.
to_serializable_dict
())
def
all_duplicated_transactions_for_use_case
(
self
,
use_case
:
str
)
->
List
[
Dict
]:
result
=
super
()
.
get_entries
(
self
.
_duplicated_transaction_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"use_case"
:
use_case
})
return
[
Transaction
.
from_serializable_dict
(
row
)
for
row
in
list
(
result
)]
def
delete_all_duplicated_transactions
(
self
,
use_case
:
str
):
collection
=
self
.
_database
[
self
.
_duplicated_transactioN_collection
]
collection
.
delete_many
({
"ApplicationType"
:
use_case
})
\ No newline at end of file
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
c793e6df
...
...
@@ -174,6 +174,16 @@ class MessageHandler:
return
transaction
=
Transaction
(
use_case
,
target_table
[
"name"
],
flattened
)
#check for duplicates
try
:
reference
=
self
.
_mongo_repo
.
get_transaction_with_id
(
transaction
.
id
())
if
reference
!=
None
:
self
.
_mongo_repo
.
add_duplicated_transaction
(
transaction
)
return
#TODO should return? or continue the message to semantic linking?
except
ValueError
as
e
:
LOGGER
.
error
(
f
"{e}, could not insert duplicated node."
)
try
:
self
.
_mongo_repo
.
add_transaction
(
transaction
)
except
ValueError
as
e
:
...
...
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