Commit 0f441888 authored by Alexander Lercher's avatar Alexander Lercher

[RoleStage] Split upload of similarity results due to size

parent bc4462e8
...@@ -104,6 +104,9 @@ class Repository(MongoRepositoryBase): ...@@ -104,6 +104,9 @@ class Repository(MongoRepositoryBase):
#endregion #endregion
#region clusterConnected #region clusterConnected
def add_connected_cluster(self, clusterDict):
super().insert_entry(self._connected_clusters_collection, clusterDict)
def add_connected_clusters(self, clusterDictArray): def add_connected_clusters(self, clusterDictArray):
''' Add Connected Clusters Data to DB ''' ''' Add Connected Clusters Data to DB '''
result = super().insert_many(self._connected_clusters_collection, clusterDictArray) result = super().insert_many(self._connected_clusters_collection, clusterDictArray)
...@@ -126,6 +129,9 @@ class Repository(MongoRepositoryBase): ...@@ -126,6 +129,9 @@ class Repository(MongoRepositoryBase):
#endregion #endregion
#region similarity #region similarity
def add_single_similarity(self, input_):
super().insert_entry(self._similarity_collection, input_)
def add_similarity(self, inputDict): def add_similarity(self, inputDict):
''' Add Similarity Data to DB ''' ''' Add Similarity Data to DB '''
#checkIfConnClustDictIsSerializable(outputJSON) #checkIfConnClustDictIsSerializable(outputJSON)
......
...@@ -126,7 +126,8 @@ def add_conn_clusters(inputDict,runId): ...@@ -126,7 +126,8 @@ def add_conn_clusters(inputDict,runId):
''' '''
outputJSON = convertLayerDictToJSON(inputDict,runId) outputJSON = convertLayerDictToJSON(inputDict,runId)
repo.add_connected_clusters(outputJSON) for element in outputJSON:
repo.add_connected_cluster(element)
def add_similarity(inputDict,runId): def add_similarity(inputDict,runId):
''' Stores cluster_similarity in the database. ''' Stores cluster_similarity in the database.
...@@ -138,4 +139,5 @@ def add_similarity(inputDict,runId): ...@@ -138,4 +139,5 @@ def add_similarity(inputDict,runId):
''' '''
outputJSON = convertSimilarityDictToJSON(inputDict,runId) outputJSON = convertSimilarityDictToJSON(inputDict,runId)
repo.add_similarity(outputJSON) for element in outputJSON:
\ No newline at end of file repo.add_single_similarity(element)
\ No newline at end of file
...@@ -37,6 +37,7 @@ from processing.similarityFiles.calculateSimilarity import * ...@@ -37,6 +37,7 @@ from processing.similarityFiles.calculateSimilarity import *
from processing.similarityFiles.miscFunctions import * from processing.similarityFiles.miscFunctions import *
from processing.similarityFiles.dataOutput import * from processing.similarityFiles.dataOutput import *
outputToFileFLAG = True
def main(layerNameList:List[str] = ["Price_Layer","FinishedTime_Layer","Destination_Layer"]): def main(layerNameList:List[str] = ["Price_Layer","FinishedTime_Layer","Destination_Layer"]):
''' '''
...@@ -48,8 +49,6 @@ def main(layerNameList:List[str] = ["Price_Layer","FinishedTime_Layer","Destinat ...@@ -48,8 +49,6 @@ def main(layerNameList:List[str] = ["Price_Layer","FinishedTime_Layer","Destinat
''' '''
print("Entered Similarity Main") print("Entered Similarity Main")
outputToFileFLAG = False
timelist = [] timelist = []
timelist.append(currentTime())#starting time timelist.append(currentTime())#starting time
......
...@@ -12,9 +12,9 @@ class Repository(MongoRepositoryBase): ...@@ -12,9 +12,9 @@ class Repository(MongoRepositoryBase):
'''This is a repository for MongoDb.''' '''This is a repository for MongoDb.'''
def __init__(self): def __init__(self):
super().__init__(netconst.BUSINESS_LOGIC_DB_HOSTNAME, super().__init__(netconst.TRACE_RETRIEVAL_DB_HOSTNAME,
netconst.BUSINESS_LOGIC_DB_PORT, netconst.TRACE_RETRIEVAL_DB_PORT,
'rest-gateway-db') 'traceRetrievalDb')
self._transaction_collection = 'transactions' self._transaction_collection = 'transactions'
self._failed_transaction_collection = 'transactions_failed' self._failed_transaction_collection = 'transactions_failed'
......
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