重定向我的java程序在qsub下的输出 [英] Redirect output of my java program under qsub

查看:125
本文介绍了重定向我的java程序在qsub下的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用qsub运行多个Java可执行程序.

I am currently running multiple Java executable program using qsub.

我写了两个脚本:1)qsub.sh,2)run.sh

I wrote two scripts: 1) qsub.sh, 2) run.sh

qsub.sh

#! /bin/bash
echo cd `pwd` \; "$@" | qsub

run.sh

#! /bin/bash
for param in 1 2 3
do
./qsub.sh java -jar myProgram.jar -param ${param}
done

鉴于以上两个脚本,我通过

Given the two scripts above, I submit jobs by

sh run.sh

我想重定向myProgram.jar -param $ {param}

I want to redirect the messages generated by myProgram.jar -param ${param}

因此,在 run.sh 中,我用以下内容替换了第四行

So in run.sh, I replaced the 4th line with the following

./qsub.sh java -jar myProgram.jar -param ${param} > output-${param}.txt

但是存储在output.txt中的消息是您的作业730("STDIN")已提交" ,这不是我想要的.

but the messages stored in output.txt is "Your job 730 ("STDIN") has been submitted", which is not what I intended.

我知道 qsub 具有用于指定输出位置的选项 -o ,但是我不知道如何在我的案例中使用此选项.

I know that qsub has an option -o for specifying the location of output, but I cannot figure out how to use this option for my case.

有人可以帮助我吗?

谢谢.

推荐答案

问题是qsub不会返回作业的输出,而是返回qsub命令本身的输出,这只是通知您的资源管理器/您希望该作业运行的调度程序.

The issue is that qsub doesn't return the output of your job, it returns the output of the qsub command itself, which is simply informing your resource manager / scheduler that you want that job to run.

您要使用qsub -o选项,但需要记住,直到作业运行完成,输出才会出现在此处.对于Torque,您可以使用qstat来检查作业的状态,所有其他资源管理器/调度程序都具有类似的命令.

You want to use the qsub -o option, but you need to remember that the output won't appear there until the job has run to completion. For Torque, you'd use qstat to check the status of your job, and all other resource managers / schedulers have similar commands.

这篇关于重定向我的java程序在qsub下的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆