Commit 4caa4224 authored by Alexander Lercher's avatar Alexander Lercher

Similarity calc: Error handling if layers contain no clusters

parent 53aba5c1
......@@ -94,7 +94,8 @@ def getClusterDataFromMongo(layerNameList,limitNrCluster,limitNrNodes):
#returns layerdiction -> Layer -> clusterDict -> Cluster -> nodesDict -> Nodes
for name in layerNameList:
newData = get_mongoDB_cluster_by_layerName(name)#repo.get_clusters_for_layer(name)
layerDict = populateWithNewNodesSingleLayer(newData[0:limitNrCluster],layerDict,limitNrNodes)
if newData is not None and len(newData) != 0:
layerDict = populateWithNewNodesSingleLayer(newData[0:limitNrCluster],layerDict,limitNrNodes)
return layerDict
......
......@@ -14,6 +14,12 @@ import math
import datetime
from typing import Dict
### init logging ###
import logging
LOG_FORMAT = ('%(levelname) -5s %(asctime)s %(name)s:%(funcName) -35s %(lineno) -5d: %(message)s')
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
LOGGER = logging.getLogger(__name__)
##################AUX
modules_path = '../../../modules/'
......@@ -56,6 +62,9 @@ def main():
layerDict = getClusterDataFromMongo(layerNameList,limitNrCluster,limitNrNodes)
if layerDict is None or len(layerDict) == 0:
LOGGER.error(f"None of the following layers existed: {str(layerNameList)}. Similarity calculation was not performed.")
return
#URLlist = None
#layerDict = getClusterDataFromSwagger(limitNrCluster,limitNrNodes, URLlist) #for Swagger, Change URLs inside the function for different input Data or provide a list with URLS
......
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