| 查看: 507 | 回复: 0 | ||
wuy069铁杆木虫 (正式写手)
|
[求助]
请教:用Shell, awk, perl等语言实现监视SGE集群节点和任务
|
|
http://muchong.com/bbs/viewthread.php?tid=5282178&fpage=1 (有100金币在这个帖子中) 请教:用Shell, awk, perl等语言实现监视SGE集群节点和任务 简单的bash shell和awk语言会点,但弄个复杂的脚本,功底还是不够 [wuy@cluster test]$ qhost -j HOSTNAME ARCH NCPU LOAD MEMTOT MEMUSE SWAPTO SWAPUS ------------------------------------------------------------------------------- global - - - - - - - compute-0-0 lx26-amd64 4 2.97 3.9G 3.5G 4.0G 2.9G job-ID prior name user state submit/start at queue master ja-task-ID ---------------------------------------------------------------------------------------------- 6 0.50500 test1.sh wuy r 12/09/2012 14:47:26 all.q@comp MASTER 7 0.60500 test4.sh wuy r 12/09/2012 14:47:26 all.q@comp MASTER all.q@comp SLAVE all.q@comp SLAVE compute-0-1 lx26-amd64 4 3.56 3.9G 3.8G 4.0G 3.1G job-ID prior name user state submit/start at queue master ja-task-ID ---------------------------------------------------------------------------------------------- 8 0.60500 test2.sh tester r 12/09/2012 14:48:52 all.q@comp MASTER all.q@comp SLAVE all.q@comp SLAVE 9 0.60500 test3.sh tester r 12/09/2012 14:48:52 all.q@comp MASTER all.q@comp SLAVE all.q@comp SLAVE 在compute-0-0节点上有两个任务6和7,所用的cpu分别为1和2;在compute-0-1节点上有两个任务8和9,所用的cpu分别为2和2. 使用Shell, awk, perl等语言获得的命令脚本打印输出下面所示: ------------------------------------------------------------------------------------------------ node state load ncpu mem memuse swapto swapus tasks jobids/users ------------------------------------------------------------------------------------------------ compute-0-0 free 2.97 4 3.9G 3.5G 4.0G 2.9G 3 6/wuy 7/wuy compute-0-1 busy 3.56 4 3.9G 3.8G 4.0G 3.1G 4 8/tester 9/tester 其中,当node的LOAD为“-”时,相应node的state为down. 下面是根据qstat命令编写脚本监视任务的申请时间和逝去时间 [wuy@cluster test]$ qstat -u '*' job-ID prior name user state submit/start at queue slots ja-task-ID ----------------------------------------------------------------------------------------------------------------- 6 0.50500 test1.sh wuy r 12/09/2012 14:47:26 all.q@compute-0-0.local 1 7 0.60500 test4.sh wuy r 12/09/2012 14:47:26 all.q@compute-0-0.local 2 8 0.60500 test2.sh tester r 12/09/2012 14:48:52 all.q@compute-0-1.local 2 9 0.60500 test3.sh tester r 12/09/2012 14:48:52 all.q@compute-0-1.local 2 [wuy@cluster test]$ qstat -j 6 |grep h_rt hard resource_list: h_rt=3600 得到的申请时间(reqtime)为3600s,改为小时制:1:00:00 逝去的时间(elaptime)为现在的时间`date`减去任务开始的时间 使用Shell, awk, perl等语言获得的命令脚本打印输出下面所示 job-ID name user state submit/start at queue slots reqtime elaptime -------------------------------------------------------------------------------------------------------------------- 6 test1.sh wuy r 12/09/2012 14:47:26 all.q@compute-0-0.local 1 1:00:00 00:50:00 7 test4.sh wuy r 12/09/2012 14:47:26 all.q@compute-0-0.local 2 2:00:00 00:50:00 8 test2.sh tester r 12/09/2012 14:48:52 all.q@compute-0-1.local 2 5:00:00 00:48:34 9 test3.sh tester r 12/09/2012 14:48:52 all.q@compute-0-1.local 2 12:00:00 00:48:34 |
» 猜你喜欢
【急招】合肥工大核聚变材料计算方向2026级工程博士生
已经有4人回复
大豆异黄酮分离
已经有0人回复
物理学I论文润色/翻译怎么收费?
已经有260人回复
湖南大学材料学院急招2026年博士生,临时增加一名博士联培指标
已经有10人回复
天津理工大学晶体材料全国重点实验室刘红军教授课题组招收博士生1-2名
已经有1人回复
中国科学院物理研究所谌志国研究员团队招收2027年博士研究生
已经有4人回复
2026年中德博士后交流项目 - 新型量子和磁性材料:材料制备表征和中子散射研究
已经有12人回复
26申博推荐:南京航空航天大学国际前沿院光学方向招收博士生!
已经有0人回复












回复此楼