Commit cf555c9f authored by Alexander Lercher's avatar Alexander Lercher

Running time slicing also if there was no clustering

Just assume one large cluster for all nodes for that layer
parent 74e9c2e7
......@@ -97,7 +97,7 @@ class Repository(MongoRepositoryBase):
super().insert_many(self._layer_nodes_collection, nodes)
def get_layer_nodes(self, layer_name: str) -> dict:
'''Returns from json'''
'''Returns all nodes for the layer.'''
entries = super().get_entries(self._layer_nodes_collection, selection={'layer_name': layer_name}, projection={'_id': 0})
return [e for e in entries]
......
......@@ -59,7 +59,12 @@ if __name__ == "__main__":
for layer in layers:
layer_name = layer.layer_name
print(f"Working on {layer_name}")
clusters_for_layer = repo.get_clusters_for_layer(layer_name)
# if no clusters were generated use one large cluster instead of skipping the layer
if clusters_for_layer is None or len(clusters_for_layer) == 0:
clusters_for_layer = [Cluster(layer_name, -1, repo.get_layer_nodes(layer_name))]
time_slices = split_clusterset_by_time(layer_name, clusters_for_layer)
for k,v in time_slices.items():
......
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