Posts

Showing posts from February, 2022

關於超算中心DGX Log Report 重覆工作 [工作筆記]

事由:我大佬叫我把每月超算中心的server的使用率output出來制作一個圖表,由於這是一個重覆任務所以我想寫一個程式幫我每月自動解決這個問題 背景: 1. 超算中心的DGX使用Slurm Workload Manager去進行提交的任務: Slurm: https://slurm.schedmd.com/documentation.html 2. 我需要先把使用率的log 存下來成為一個檔 Slurm Linux Get Report(need root): sacct --starttime 2022-01-01 --format=User,Account,JobID,Jobname,partition,state,time,submit,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist,AllocTRES%30 -p > log_output_2022_01.txt 3. 準備一個python檔把這個log output 生成一個excel and jpg, 這是進行時得出上一個月的所有log data Linux Get DGX LOG Report Python Script (need root): import datetime import numpy as np import pandas as pd import datetime import re # def the output report and image file name today = datetime.date.today() month_first_day = today.replace(day=1) lastMonth = month_first_day - datetime.timedelta(days=1) input_log_file_name = f"DGX_Cluster_log/dgx_log_output_{lastMonth.strftime('%Y_%m')}.txt" report_file_name = f"DGX_Cluster_log/DGX_Cluster_report_{lastMonth.strftime(...