Skip to content

Commit 6e2e33d

Browse files
authored
Portion visualizer improvement (#18284)
Adds file printing and better resolution
1 parent c0ae37f commit 6e2e33d

File tree

1 file changed

+8
-2
lines changed
  • ydb/core/tx/columnshard/tools/visualize_portions

1 file changed

+8
-2
lines changed

ydb/core/tx/columnshard/tools/visualize_portions/__main__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def GetLevelColours(maxLevel):
120120
""")
121121
parser.add_argument("-i", "--input-file", help="File with primary_index_portion_stats data in json per row format", required=True)
122122
parser.add_argument("-t", "--type", help="First PK column type: Integer or Timestamp", required=True)
123+
parser.add_argument("-o", "--output-file", help="Output file", required=False)
123124
args = parser.parse_args()
124125
inputFile = args.input_file
125126
pk0Type = FirstPkColumnType[args.type]
@@ -130,7 +131,9 @@ def GetLevelColours(maxLevel):
130131
levelColors = GetLevelColours(portions.MaxCompactionLevel)
131132
rectangles = [p.ToRectangle(levelColors) for p in portions.Portions]
132133

133-
fig, ax = plt.subplots()
134+
dpi = 300
135+
figsize = (12000 / dpi, 9000 / dpi)
136+
fig, ax = plt.subplots(figsize=figsize, dpi=dpi)
134137
ax.set_title("Column table portions")
135138
ax.add_collection(PatchCollection(rectangles, match_original=True))
136139

@@ -156,4 +159,7 @@ def GetLevelColours(maxLevel):
156159
dy = yMax - yMin
157160
ax.set_ylim(yMin - 0.05 * dy, yMax + 0.05 * dy)
158161

159-
plt.show()
162+
if args.output_file is None:
163+
plt.show()
164+
else:
165+
plt.savefig(args.output_file, dpi=dpi)

0 commit comments

Comments
 (0)