我试图了解如何使用 squeue 按提交时间排序。 我知道我可以按如下方式使用队列,这样它就会显示提交时间,
squeue -O "stepid:6,username:8,account:7,name:53,partition:15,submittime:20"
但是我如何让它按提交时间排序。
谢谢。
通常,您会使用
--sort
的 squeue
选项:
-S <sort_list>, --sort=<sort_list>
Specification of the order in which records should be reported. This uses the same field specification as the <output_format>. Multiple sorts may be performed by
listing multiple sort fields separated by commas. The field specifications may be preceded by "+" or "-" for ascending (default) and descending order respectively.
For example, a sort value of "P,U" will sort the records by partition name then by user id. The default value of sort for jobs is "P,t,-p" (increasing partition name
then within a given partition by increasing job state and then decreasing priority). The default value of sort for job steps is "P,i" (increasing partition name then
within a given partition by increasing step id).
“output_format”中的提交时间(与
-o, --format
一起使用的格式 - 不是您正在使用的与 -O, --Format
一起使用的格式)是 %V
。
不幸的是,在我的系统上这会导致错误。不知道为什么会这样。
$ /usr/bin/squeue -S V
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
squeue: error: Invalid sort specification: V
所以我想你应该简单地使用
sort
实用程序:
squeue -O "stepid:6,username:8,account:7,name:53,partition:15,submittime:20" | sort -k4
这将起作用,因为时间格式允许按字母数字顺序进行比较。
-S, --sort
使用与输出格式相同的字段。
你可以简单地做
squeue -S "SubmitTime"