通过 grep qstat 输出并将 jobid 发送到 qdel 来删除作业?

发布于 2024-10-10 01:32:38 字数 1162 浏览 9 评论 0原文

我在集群上使用 PBS 作业调度程序,并且我想使用 qdel 删除早于特定日期的作业;或者,能够按日期对 qstat 结果进行排序就足够了。

qstat 给出以下输出:

job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
 326539 0.50500 run        user         r     01/06/2011 11:13:34 [email protected]            1        
 326594 0.50500 run        user         r     01/06/2011 11:13:34 [email protected]            1    

我可以使用 qdel 删除作业:

qdel 326539

并且可以使用 grep 找到我要删除的作业:

qstat > foo; grep 01/06 foo

我当前的工作周围的方法是将上面的输出粘贴到电子表格中,按作业 ID 排序,然后 qdel {min..max}

我可以将这些步骤合并到一个命令中吗?

感谢您的帮助。

I am using PBS job scheduler on my cluster, and I would like to delete jobs older than a certain date using qdel; alternatively it would be sufficient to be able to sort the results of qstat by date.

qstat gives this output:

job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
 326539 0.50500 run        user         r     01/06/2011 11:13:34 [email protected]            1        
 326594 0.50500 run        user         r     01/06/2011 11:13:34 [email protected]            1    

and I can delete jobs with qdel:

qdel 326539

and the jobs I want to delete can be located using grep:

qstat > foo; grep 01/06 foo

my current work around is to paste the output from above into a spreadsheet, sort by job-ID, and then qdel {min..max},

Can I combine these steps into a single command?

Assistance appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以往的大感动 2024-10-17 01:32:38

awk

qstat | awk '$6 ~ "01/06" {cmd="qdel " $1; system(cmd); close(cmd)}'

Bash

#!/bin/bash

match="01/06"

while read job; do
  set -- $job
  if [[ $6 =~ $match ]]; then
    qdel "$1"
  fi
done < <(qstat)

如果您想进行空运行,请将 qdel "$1" 更改为 echo qdel "$1" 看看它会做什么。

awk

qstat | awk '$6 ~ "01/06" {cmd="qdel " $1; system(cmd); close(cmd)}'

Bash

#!/bin/bash

match="01/06"

while read job; do
  set -- $job
  if [[ $6 =~ $match ]]; then
    qdel "$1"
  fi
done < <(qstat)

If you want to do a dry-run, then change qdel "$1" to echo qdel "$1" to see what it would have done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文