File tree 1 file changed +8
-0
lines changed 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ def merge(files, accumulate=True):
33
33
But if writing the merged data back to mmap files, use
34
34
accumulate=False to avoid compound accumulation.
35
35
"""
36
+ metrics = MultiProcessCollector ._read_metrics (files )
37
+ return MultiProcessCollector ._accumulate_metrics (metrics , accumulate )
38
+
39
+ @staticmethod
40
+ def _read_metrics (files ):
36
41
metrics = {}
37
42
for f in files :
38
43
parts = os .path .basename (f ).split ('_' )
@@ -55,7 +60,10 @@ def merge(files, accumulate=True):
55
60
# The duplicates and labels are fixed in the next for.
56
61
metric .add_sample (name , labels_key , value )
57
62
d .close ()
63
+ return metrics
58
64
65
+ @staticmethod
66
+ def _accumulate_metrics (metrics , accumulate ):
59
67
for metric in metrics .values ():
60
68
samples = defaultdict (float )
61
69
buckets = {}
You can’t perform that action at this time.
0 commit comments