在没有实际作业文件的情况下提交qsub作业的语法? [英] Syntax for submitting a qsub job without an actual job file?
问题描述
我想在不创建离散作业文件的情况下即时提交qsub作业.因此,假设我有一个名为"get_time.py"的python脚本,它仅报告时间.而不是像这样编写提交脚本:
I would like to submit qsub jobs on the fly without creating discrete job files. So, let's say I have a python script called "get_time.py" that simply reports the time. Instead of making a submission script like this:
cat>job.sub<<eof
#PBS -l walltime=1:00:00
cd $PBS_O_WORKDIR
get_time.py
eof
...然后提交作业:qsub job.sub
...and then submitting the job: qsub job.sub
我希望能够绕过文件创建步骤,并且我想构造的图像应该是这样的:
qsub -d . -e get_time.py
I would like to be able to bypass the file creation step, and I'd image the construct would be something like this:
qsub -d . -e get_time.py
其中-e
是我的虚构参数,告诉qsub以下代码是要发送到调度程序的代码,而不是使用离散的提交文件.
where -e
is my imaginary parameter that tells qsub that the following is code to be sent to the scheduler, instead of using a discrete submission file.
我疯了吗?似乎应该已经有一个简单的解决方案,但是我在任何地方都找不到.感谢您的任何建议!
Am I crazy? It seems like there should already be a simple solution for this, but I couldn't find it anywhere. Thanks for any suggestions!
推荐答案
提供所有选项(-d .
等)后,可以将任何可执行脚本/文件的名称传递给qsub
.脚本名称之后的所有参数都将被视为该脚本的参数.例如,如果我有脚本test.py:
You can pass the name of any executable script/file to qsub
after you've provided all your options (-d .
, etc.). Any arguments that come after the script name are treated as arguments for that script. For example, if I had the script test.py:
#!/usr/bin/python
from sys import argv
script, param = argv
print param
那我可以跑步
qsub test.py 2
,输出到我的日志将是2
.
and the output to my log will be 2
.
要注意的两个重要事项:
Two important things to note:
- 您的Python脚本必须是可执行的(例如
chmod +x test.py
). - 您的Python脚本必须具有shebang(例如
#!/usr/bin/python
).
- Your Python script must be executable (e.g.
chmod +x test.py
). - Your Python script must have a shebang (e.g.
#!/usr/bin/python
).
这篇关于在没有实际作业文件的情况下提交qsub作业的语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!