在“时间限制”上写入日志

发布于 2025-01-14 06:37:14 字数 556 浏览 1 评论 0原文

我在工作期间运行了一堆命令。例如:

#!/bin/bash -l
#SBATCH --time 1-00:00:00
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 1
#SBATCH --job-name foo
#SBATCH --out foo_%j.out

stdbuf -o0 -e0 mycommand input1.yaml
stdbuf -o0 -e0 mycommand input2.yaml
stdbuf -o0 -e0 mycommand input3.yaml
stdbuf -o0 -e0 mycommand input4.yaml
stdbuf -o0 -e0 mycommand input5.yaml
stdbuf -o0 -e0 mycommand input6.yaml
stdbuf -o0 -e0 mycommand input7.yaml

如果我的工作在达到时间限制时被削减,我想知道它在哪里被削减,以便能够轻松地继续和/或删除损坏的数据。

I run a bunch of commands during my job. For example:

#!/bin/bash -l
#SBATCH --time 1-00:00:00
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 1
#SBATCH --job-name foo
#SBATCH --out foo_%j.out

stdbuf -o0 -e0 mycommand input1.yaml
stdbuf -o0 -e0 mycommand input2.yaml
stdbuf -o0 -e0 mycommand input3.yaml
stdbuf -o0 -e0 mycommand input4.yaml
stdbuf -o0 -e0 mycommand input5.yaml
stdbuf -o0 -e0 mycommand input6.yaml
stdbuf -o0 -e0 mycommand input7.yaml

If my job get cut when it reaches the time limit, I would like to know where it was cut in order to be able to easily continue and/or remove corrupted data.

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

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

发布评论

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

评论(1

谷夏 2025-01-21 06:37:15

我不知道这是否是您所需要的,但无论如何您可以使用 echo 将其打印出来。

#!/bin/bash -l
#SBATCH --time 1-00:00:00
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 1
#SBATCH --job-name foo
#SBATCH --out foo_%j.out

stdbuf -o0 -e0 mycommand input1.yaml
echo "Finished Job step 1"
stdbuf -o0 -e0 mycommand input2.yaml
echo "Finished Job step 2"
stdbuf -o0 -e0 mycommand input3.yaml
echo "Finished Job step 3"

您也可以将其写入单独的文件中,例如。例如,echo“message”>> job_record.out

I don't know whether this is what you need, but anyways you could just print it out using echo.

#!/bin/bash -l
#SBATCH --time 1-00:00:00
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 1
#SBATCH --job-name foo
#SBATCH --out foo_%j.out

stdbuf -o0 -e0 mycommand input1.yaml
echo "Finished Job step 1"
stdbuf -o0 -e0 mycommand input2.yaml
echo "Finished Job step 2"
stdbuf -o0 -e0 mycommand input3.yaml
echo "Finished Job step 3"

You could also write this into a separate file like. For example, echo "message" >> job_record.out

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