如何提交调用我的python脚本的SGE作业(How to submit a SGE job calling my python script)

编程入门 行业动态 更新时间:2024-10-24 02:35:30
如何提交调用我的python脚本的SGE作业(How to submit a SGE job calling my python script)

所以,我想在远程机器上运行python脚本。 但是,在服务器的手册中,他们这样说:

您需要创建此脚本并保存它。

#!/bin/bash #$ -V ## pass all environment variables to the job, VERY IMPORTANT #$ -N run_something ## job name #$ -S /bin/bash ## shell where it will run this job #$ -j y ## join error output to normal output #$ -cwd ## Execute the job from the current working directory #$ -q lowmemory.q ## queue name uptime > myUptime.${JOB_ID}.txt echo $HOSTNAME >> myUptime.${JOB_ID}.txt

因此,如果这个脚本名为blast_AE004437.sh,我们可以运行以下命令来完成所有这些步骤。

qsub my_script.sh

所以,我假设我需要创建一个.sh文件来运行它并将所有这些命令添加到我的原始脚本中。 是吗? 因为我这样做并没有任何反应。 在所有这些命令之后,我还添加了“python2.7”来加载python。 我做错了什么? 顺便说一句,输出将出现在同一个文件中,还是我需要下载不同的文件?

So, I want to run a python script in a remote machine. However, in the manual of the server, they say this:

You need to create this script and save it.

#!/bin/bash #$ -V ## pass all environment variables to the job, VERY IMPORTANT #$ -N run_something ## job name #$ -S /bin/bash ## shell where it will run this job #$ -j y ## join error output to normal output #$ -cwd ## Execute the job from the current working directory #$ -q lowmemory.q ## queue name uptime > myUptime.${JOB_ID}.txt echo $HOSTNAME >> myUptime.${JOB_ID}.txt

So if this script was called blast_AE004437.sh we could run the following to make all of those steps happen.

qsub my_script.sh

So, I'm assuming that I need to create a .sh file to run this and add all this commands to my original script. Is that it? Because I'm doing that and nothing happens. After all this commands I also add "python2.7" to load python. What I'm doing wrong? By the way, the output will come out in the same file or do I need to download a different file?

最满意答案

您列出的文件是作业调度程序调用的SGE运行脚本的开头。 qsub将其提交给调度系统。 只要群集计算机上有空闲插槽,就会在那里调用运行脚本。

我建议你在这个文件中调用自己的脚本。

... echo $HOSTNAME >> myUptime.${JOB_ID}.txt cd /directory/of/your/script # change directory python2.7 your_script.py arg1 arg2 ... >> output.${JOB_ID}.log # call your script

通常,您还需要手动设置$ PATH变量和$ PYTHONPATH变量,然后才能调用python。

The file you listed is the beginning of a SGE run script which is called by the job scheduler. qsub submits it to the scheduling system. As soon as there is a free slot on a cluster machine, the run script is called there.

I suggest you to call your own script in this file.

... echo $HOSTNAME >> myUptime.${JOB_ID}.txt cd /directory/of/your/script # change directory python2.7 your_script.py arg1 arg2 ... >> output.${JOB_ID}.log # call your script

Often you also need to set the $PATH variable and $PYTHONPATH variable manually before you can call python.

更多推荐

本文发布于:2023-07-23 18:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1235703.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   脚本   SGE   python   script

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!