如何获得qstat
给我完整的工作名称?
我知道qstat -r
提供了有关该任务的详细信息,但是它太多了,并且包括了资源需求。qstat -r
输出类似于:
131806 0.25001 tumor_foca ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: tumor_focality-TCGA-THCA-ratboost_linear_svc
Hard Resources: distribution=wheezy (0.000000)
h_rt=72000 (0.000000)
mem_free=15G (0.000000)
h_vmem=15G (0.000000)
h_stack=256M (0.000000)
Soft Resources:
131807 0.25001 vital_stat ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: vital_status-TCGA-LGG-ratboost_linear_svc
Hard Resources: distribution=wheezy (0.000000)
h_rt=72000 (0.000000)
mem_free=15G (0.000000)
h_vmem=15G (0.000000)
h_stack=256M (0.000000)
Soft Resources:
现在,我唯一的选择是根据需要
grep
输出:$ qstat -r | grep "Full jobname" -B1
--
131806 0.25001 tumor_foca ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: tumor_focality-TCGA-THCA-ratboost_linear_svc
--
131807 0.25001 vital_stat ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: vital_status-TCGA-LGG-ratboost_linear_svc
我可以做得更好些吗?
最佳答案
这个有点困惑,但是它作为命令历史记录中的一个简单解决方案。所有标准工具。输出与从常规qstat调用中获得的输出几乎相同,但不会获得 header :
单线:
qstat -xml | tr '\n' ' ' | sed 's#<job_list[^>]*>#\n#g' \
| sed 's#<[^>]*>##g' | grep " " | column -t
命令说明:
将作业列为XML:
qstat -xml
删除所有换行符:
tr '\n' ' '
在列表中的每个作业条目之前添加换行符:
sed 's#<job_list[^>]*>#\n#g'
删除所有XML内容:
sed 's#<[^>]*>##g'
hack最后添加换行符:
grep " "
列化:
column -t
示例输出
351996 0.50502 ProjectA_XXXXXXXXX_XXXX_XXXXXX user123 r 2015-06-25T15:38:41 [email protected] 1
351997 0.50502 ProjectA_XXX_XXXX_XXX user123 r 2015-06-25T15:39:26 [email protected] 1
351998 0.50502 ProjectA_XXXXXXXXXXXXX_XXXX_XXXX user123 r 2015-06-25T15:40:26 [email protected] 1
351999 0.50502 ProjectA_XXXXXXXXXXXXXXXXX_XXXX_XXXX user123 r 2015-06-25T15:42:11 [email protected] 1
352001 0.50502 ProjectA_XXXXXXXXXXXXXXXXXXXXXXX_XXXX_XXXX user123 r 2015-06-25T15:42:11 [email protected] 1
352008 0.50501 runXXXX69 usr1 r 2015-06-25T15:49:04 [email protected] 1
352009 0.50501 runXXXX70 usr1 r 2015-06-25T15:49:04 [email protected] 1
352010 0.50501 runXXXX71 usr1 r 2015-06-25T15:49:04 [email protected] 1
352011 0.50501 runXXXX72 usr1 r 2015-06-25T15:49:04 [email protected] 1
352012 0.50501 runXXXX73 usr1 r 2015-06-25T15:49:04 [email protected] 1
352013 0.50501 runXXXX74 usr1 r 2015-06-25T15:49:04 [email protected] 1
关于linux - qstat和长作业名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26104116/