26Y01d5

Young-Kyoo Kim·약 14시간 전
# step3_analytics.py 내부의 관련 차트 생성 구역을 아래와 같이 고도화합니다.

print("⏳ [Boxplot 엔지니어링] 워크로드별 CPU/MEM 활용 분포 및 Outlier 트래킹 중...")

# 1. CPU Utilization Boxplot
plt.figure(figsize=(11, 5))
sns.boxplot(
    data=df_pod, 
    x="workload_type", 
    y="cpu_util", 
    palette="Set3",
    showmeans=True,  # 💡 박스 내부에 평균값(Mean)을 삼각형으로 표시
    meanprops={"marker":"^", "markerfacecolor":"green", "markeredgecolor":"green"},
    flierprops={"marker":"X", "markerfacecolor":"red", "markeredgecolor":"red", "markersize":6} # 💡 Outlier 격별 강조
)
plt.xticks(rotation=30, ha="right")
plt.ylim(-5, 105)
plt.title("CPU Utilization P95 Boxplot & Outliers by Workload Type")
plt.xlabel("Workload Type")
plt.ylabel("P95 Actual Utilization (%)")
plt.tight_layout()
plt.savefig(PLOT_DIR / "chart9_boxplot_cpu_util_by_workload.png", dpi=100)
plt.close()

# 2. Memory Utilization Boxplot
plt.figure(figsize=(11, 5))
sns.boxplot(
    data=df_pod, 
    x="workload_type", 
    y="mem_util", 
    palette="Pastel1",
    showmeans=True,
    meanprops={"marker":"^", "markerfacecolor":"green", "markeredgecolor":"green"},
    flierprops={"marker":"X", "markerfacecolor":"red", "markeredgecolor":"red", "markersize":6}
)
plt.xticks(rotation=30, ha="right")
plt.ylim(-5, 105)
plt.title("Memory Utilization P95 Boxplot & Outliers by Workload Type")
plt.xlabel("Workload Type")
plt.ylabel("P95 Actual Utilization (%)")
plt.tight_layout()
plt.savefig(PLOT_DIR / "chart10_boxplot_mem_util_by_workload.png", dpi=100)
plt.close()


===

# step6_excel_builder.py 내의 각 시트 빌더 함수 최하단에 앵커를 정확히 고정합니다.

# ─── 2번 CPU 분석 탭 하단 ───
def build_sheet_cpu(wb, df_pod, infra_tag):
    # ... 상단 데이터 로우 로직 동일 ...
    end_row = apply_data_rows(ws, df_out[cols], start_row=3, num_formats={8:"0.00",9:"0.00",10:"0.00",11:"0.00",12:"0.0",13:"#,##0.0"}, status_col_idx=14)
    set_col_widths(ws, {"A":12,"B":14,"C":16,"D":18,"E":16,"F":26,"G":14,"H":12,"I":12,"J":12,"K":14,"L":12,"M":14,"N":16})
    freeze_and_filter(ws)
    
    # 💡 데이터 로우가 끝나는 지점(end_row) 아래에 3칸 마진을 두고 바 차트와 Outlier 박스플롯을 나란히 수직 정렬
    add_chart_image(ws, "chart1_cpu_req_vs_usage_by_workload.png", f"A{end_row+3}", w=800, h=380, label="[ Average CPU Request vs Peak Usage ]")
    add_chart_image(ws, "chart9_boxplot_cpu_util_by_workload.png",  f"A{end_row+24}", w=800, h=380, label="[ CPU Outliers & Distribution Boxplot ]")


# ─── 3번 Memory 및 PV 분석 탭 하단 ───
def build_sheet_memory(wb, df_pod, infra_tag):
    # ... 상단 데이터 로우 로직 동일 ...
    end_row = apply_data_rows(ws, df_out[cols], start_row=3, num_formats={8:"0.0",9:"0.0",10:"0.0",11:"0.0",12:"0.0",13:"#,##0",14:"0.0",15:"#,##0"}, status_col_idx=16)
    set_col_widths(ws, {"A":12,"B":14,"C":16,"D":18,"E":16,"F":26,"G":14,"H":12,"I":12,"J":12,"K":12,"L":12,"M":14,"N":12,"O":12,"P":16})
    freeze_and_filter(ws)
    
    # 💡 메모리 분석 탭 하단에도 Working Set 대비 순수 RSS 메모리 박스플롯을 자동 임베딩
    add_chart_image(ws, "chart2_mem_req_vs_usage_by_workload.png", f"A{end_row+3}", w=800, h=380, label="[ Average Memory Specs vs RSS Peak ]")
    add_chart_image(ws, "chart10_boxplot_mem_util_by_workload.png", f"A{end_row+24}", w=800, h=380, label="[ Memory Outliers & Distribution Boxplot ]")

0개의 댓글