前言:
lsfMonitor是一款發佈於2017年的開源工具,因爲最近諮詢用法和使用問題的比較多,所以在安裝包中增補了用戶文檔docs/lsfMonitor_user_manual.pdf,用於幫助用戶更快上手,主要內容如下。
一、簡介
lsfMonitor就是爲如上需求提供一站式解決方案。
二、環境依賴
2.1 操作系統依賴
建議在centos7.9操作系統下使用。
2.2 python版本依賴
不同版本的python可能會有python庫版本問題,按照系統要求安裝對應版本的python庫即可解決。
2.3 集羣管理工具
LSF 9.*/10.*的版本支持較好,Openlava幾個版本間output message有一定差異,並不是所有版本都能夠很好支持。
三、工具安裝及配置
3.1 工具下載
可以採用“git clone https://github.com/liyanqing1987/lsfMonitor.git”的方式拉取源代碼。
[[email protected] test]$ git clone https://github.com/liyanqing1987/lsfMonitor.git
Cloning into 'lsfMonitor'...
remote: Enumerating objects: 709, done.
remote: Counting objects: 100% (281/281), done.
remote: Compressing objects: 100% (171/171), done.
remote: Total 709 (delta 177), reused 208 (delta 109), pack-reused 428
Receiving objects: 100% (709/709), 908.67 KiB | 594.00 KiB/s, done.
Resolving deltas: 100% (442/442), done.
也可以在lsfMonitor的github頁面上,Code -> Download ZIP的方式拉取代碼包。
如果國內的用戶不方便訪問github,也可以通過如下gitee https://gitee.com/liyanqing1987/ic_flow_platform獲取lsfMonitor的源代碼。
3.2 工具安裝
[[email protected] tools]$ cd lsfMonitor/
[[email protected] lsfMonitor]$ ls
db docs install.py lib LICENSE monitor README requirements.txt
確認python版本正確,並基於安裝包中的requirements.txt安裝python依賴庫。
[[email protected] licenseMonitor]# pip3 install -r requirements.txt
Looking in indexes: https://bytedpypi.byted.org/simple/
Requirement already satisfied: pexpect==4.8.0 in /ic/software/tools/python3/3.8.8/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (4.8.0)
Requirement already satisfied: ptyprocess>=0.5 in /ic/software/tools/python3/3.8.8/lib/python3.8/site-packages (from pexpect==4.8.0->-r requirements.txt (line 1)) (0.7.0)
在安裝目錄下,使用命令“python3 install.py”安裝lsfMonitor。
[[email protected] lsfMonitor]# python3 install.py
>>> Check python version.
Required python version : (3, 5)
Current python version : (3, 8)
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/bin/bmonitor".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/bin/bsample".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/tools/check_issue_reason".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/tools/seedb".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/tools/process_tracer".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/tools/show_license_feature_usage".
>>> Generate config file "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/monitor/conf/config.py".
Done, Please enjoy it.
3.3 工具配置
# Specify the database directory.
db_path = "/ic/data/usr/liyanqing.1987/tools/lsfMonitor/db"
# Specify lmstat path, example "/*/*/bin".
lmstat_path = ""
# Specify lmstat bsub command, example "bsub -q normal -Is".
lmstat_bsub_command = ""
一個使用的demo配置如下。
# Specify the database directory.
db_path = "/ic/software/cad_data/it/lsfMonitor/db"
# Specify lmstat path.
lmstat_path = "/ic/software/synopsys/scl/2021.03/linux64/bin"
# Specify lmstat bsub command.
lmstat_bsub_command = "bsub -q normal -Is"
四、工具使用
4.1 數據採集 bsample
[[email protected] lsfMonitor]$ monitor/bin/bsample -h
usage: bsample.py [-h] [-j] [-q] [-H] [-l] [-u] [-i INTERVAL]
optional arguments:
-h, --help show this help message and exit
-j, --job Sample running job info with command "bjobs -u all -r -UF".
-q, --queue Sample queue info with command "bqueues".
-H, --host Sample host info with command "bhosts".
-l, --load Sample host load info with command "lsload".
-u, --user Sample user info with command "busers".
-i INTERVAL, --interval INTERVAL
Specify the sampling interval, unit is second. Sampling only once by default".
我們推薦用crontab來定時採樣(Jenkins類似),採樣時間爲5分鐘,只採集job/queue/load信息,下面是一個示例。
# For lsfMonitor
*/5 * * * * /ic/software/cad_tools/it/lsfMonitor/monitor/bin/bsample -j
*/5 * * * * /ic/software/cad_tools/it/lsfMonitor/monitor/bin/bsample -q
*/5 * * * * /ic/software/cad_tools/it/lsfMonitor/monitor/bin/bsample -l
4.2 數據展示 bmonitor
4.2.1 工具載入
-
直接引用bmonitor絕對路徑。
-
採用modules管理和加載環境,引用bmonitor腳本名即可。
-
將bmonitor連接到LSF的bsub腳本路徑中,引用bmonitor腳本名即可。
推薦第三種方式,下面是具體效果。
[[email protected] ~]$ which bmonitor
/ic/software/tools/lsf/10.1/linux2.6-glibc2.3-x86_64/bin/bmonitor
4.2.2 幫助信息
[[email protected] lsfMonitor]$ monitor/bin/monitor -h
usage: bmonitor.py [-h] [-j JOBID] [-u USER] [-f FEATURE] [-t {JOB,JOBS,HOSTS,QUEUES,LOAD,LICENSE}] [-dl]
optional arguments:
-h, --help show this help message and exit
-j JOBID, --jobid JOBID
Specify the jobid which show it's information on "JOB" tab.
-u USER, --user USER
Specify the user show how's job information on "JOBS" tab.
-f FEATURE, --feature FEATURE
Specify license feature which you want to see on "LICENSE" tab.
-t {JOB,JOBS,HOSTS,QUEUES,LOAD,LICENSE}, --tab {JOB,JOBS,HOSTS,QUEUES,LOAD,LICENSE}
Specify current tab, default is "JOB" tab.
-dl, --disable_license
Disable license check function.
4.2.3 JOB頁
lsfMonitor的JOB頁,主要用於查看指定job的詳細信息,以及job內存用量的歷史曲線。
-
獲取job詳細信息和內存用量曲線
通過job的詳細信息,可以幫助用戶debug如下常見問題。
內存超量問題 :如果job是EXIT狀態,且Mem值大於Rusage值,說明有潛在可能是因爲內存(不足)問題導致了job被kill。
-
追蹤job進程(trace job slow issue)
此時是以進程樹的方式展現job相關的所有進程,其中核心進程是下面EDA工具的進程。
進程的系統交互情況可以幫助用戶判斷job運行緩慢的原因,絕大多數情況下,EDA工具運行極端緩慢都是由於工具本身問題導致的。
4.2.4 JOBS頁
-
jobs基本信息
Host | Started | Processer | Slot | Rusage | Mem |
job執行的機器 | job開始RUN的時間 | job申請的cpu核數 | job申請的slots | job申請的memory | job實際使用的memory |
-
jobs特殊操作/顯示
如果Status列爲PEND,點擊PEND,可以通過工具“check_issue_reason”來查看job PEND的原因。
4.2.5 HOSTS頁
-
hosts基本信息
Queue | Ncpus | MAX | Njobs | Ut | Maxmem | Mem | Tmp |
host所屬的隊列 | host的cpu物理核數 | host接收job的最大數目 | host上job的數目 | host的cpu使用率 | host的內存大小 | host的內存可用量 | host的/tmp空間可用量 |
-
hosts特殊操作/顯示
如果host的tmp可用量變爲0,Tmp值會顯示爲紅色,標識/tmp過載。
4.2.6 QUEUES頁
如果queue中PEND的job數目不爲0,數字會被紅標。
其中queue的PEND/RUN的歷史數據默認展示15天,每天的值都是一個統計均值。
4.2.7 LOAD頁
可以通過“Host”下拉菜單選擇機器,可以通過“Date”下拉菜單選擇時間段(默認是一天)。
其中ut和mem的曲線均可以通過放大鏡按鈕放大指定部位,也可以通過HOME按鈕恢復原狀。
4.2.8 LICENSE頁
-
license過濾
點擊“In_use”列的數字(如果數字非零),可以查看具體誰使用了這些license。
如果某個license feature的START_TIME早於3天前,會標紅。
-
license信息
Server | Vendor | Feature | Issued | In_use |
license server名 | Vendor daemon名 | license feature名 | 一般認爲是license file中license的總數,包括過期的部分。 |
在使用的liense feature數目。
|
License Server | Feature | Num | Expires |
license server名 |
license feature名。
因爲license file可以追加內容,所以同一feature可能在同一license server中出現多次。
|
License feature數目
|
過期日期
過期會標灰
兩週內過期會標紅
|
4.2.9 其它功能
-
信息刷新功能
-
異常job問題檢查
在彈出的Check Issue Reason工具中,輸入jobid,點擊“Check”按鈕,如果顯示相關問題的檢測結果。
五、輔助工具
[[email protected] lsfMonitor]$ ls monitor/tools/
check_issue_reason check_issue_reason.py message.py process_tracer process_tracer.py seedb seedb.py show_license_feature_usage show_license_feature_usage.py
show_license_feature_usage: 組件,圖形界面工具,查看license feature的使用情況。
5.1 seedb
[[email protected] lsfMonitor]$ monitor/tools/seedb -h
usage: seedb.py [-h] -d DATABASE [-t TABLES [TABLES ...]] [-k KEYS [KEYS ...]] [-n NUMBER]
optional arguments:
-h, --help show this help message and exit
-d DATABASE, --database DATABASE
Required argument, specify the datebase file.
-t TABLES [TABLES ...], --tables TABLES [TABLES ...]
Specify the tables you want to review, make sure the tables exist.
-k KEYS [KEYS ...], --keys KEYS [KEYS ...]
Specify the table keys you want to review, make sure the table keys exist.
-n NUMBER, --number NUMBER
How many lines you want to see.
下面是一個使用示例,查看load.db數據庫中,查看load_n212-206-211表中mem列的前五行數據。
[[email protected] lsfMonitor]$ monitor/tools/seedb -d /ic/software/cad_data/it/lsfMonitor/db/monitor/load.db -t load_n212-206-211 -k mem -n 5
DB FILE : /ic/software/cad_data/it/lsfMonitor/db/monitor/load.db
TABLE : load_n212-206-211
========
mem
----
911.9G
910G
908.1G
906G
904.6G
========
附錄
附1. 變更歷史
日期 | 版本 | 變更描述 | 源代碼變更 |
2017 | 1.0 | 發佈第一個版本openlavaMonitor,僅支持openlava。 | |
2020 | 1.1 | 更名lsfMonitor,增加對LSF的支持。 | |
2022 | 1.2 | 增加對LICENSE信息獲取的支持。 |