@@ -288,7 +288,15 @@ def __findClusterOutliers(self, data):
288
288
"""
289
289
Finds rank outliers by their total execution times.
290
290
"""
291
- data , clusters , cluster_to_times , cluster_to_ranks , cluster_centers , representative_cluster , representative_center , threshold , problematic_clusters = self .__clusterTimes (data )
291
+ data , \
292
+ clusters , \
293
+ cluster_to_times , \
294
+ cluster_to_ranks , \
295
+ cluster_centers , \
296
+ representative_cluster , \
297
+ representative_center , \
298
+ threshold , \
299
+ problematic_clusters = self .__clusterTimes (data )
292
300
293
301
## warnings if representative cluster is actually the slowest
294
302
# identify if representative cluster has slowest center
@@ -308,7 +316,11 @@ def __findClusterOutliers(self, data):
308
316
if representative_center - 3 * np .std (cluster_to_times [representative_cluster ]) > slowest_non_representative_center :
309
317
print ()
310
318
print (f" WARNING: Clustering results found most times to be slower than others. No outliers will be detected." )
311
- print (f" Most times are centered around { representative_center :.2f} , but other ranks ran in { fastest_non_representative_center :.2f} -{ slowest_non_representative_center :.2f} s" )
319
+ print (
320
+ f" Most times are centered around { representative_center :.2f} , "
321
+ f"but other ranks ran in { fastest_non_representative_center :.2f} -"
322
+ f"{ slowest_non_representative_center :.2f} s"
323
+ )
312
324
print ()
313
325
314
326
node_to_ranks = {}
@@ -320,7 +332,11 @@ def __findClusterOutliers(self, data):
320
332
# write clustering results to file
321
333
with open (os .path .join (self .__output_dir , f"clustering_results.txt" ), 'w' ) as file :
322
334
for cluster in sorted (np .unique (np .array (clusters ))):
323
- file .write (f"* Cluster { cluster } { '(representative)' if cluster == representative_cluster else '' } { '(outlier)' if cluster_centers [cluster ] > threshold else '' } :\n " )
335
+ representative_label = '(representative)' if cluster == representative_cluster else ''
336
+ outlier_label = '(outlier)' if cluster_centers [cluster ] > threshold else ''
337
+ file .write (
338
+ f"* Cluster { cluster } { representative_label } { outlier_label } :\n "
339
+ )
324
340
325
341
# Print ranks in cluster, grouped by nodes
326
342
for node , ranks in node_to_ranks .items ():
@@ -383,7 +399,9 @@ def __printClusteringResults(self, clusters, cluster_to_ranks, cluster_centers,
383
399
print (f"Representative cluster: { representative_cluster } " )
384
400
print ()
385
401
for cluster in sorted (np .unique (np .array (clusters ))):
386
- print (f" * Cluster { cluster } { '(representative)' if cluster == representative_cluster else '' } { '(outlier)' if cluster_centers [cluster ] > threshold else '' } contains:" )
402
+ representative_label = '(representative)' if cluster == representative_cluster else ''
403
+ outlier_label = '(outlier)' if cluster_centers [cluster ] > threshold else ''
404
+ print (f" * Cluster { cluster } { representative_label } { outlier_label } contains:" )
387
405
cluster_nodes = []
388
406
for rank , node in self .__rank_to_node_map .items ():
389
407
if rank in cluster_to_ranks [cluster ]:
0 commit comments