所以,我想在远程机器上运行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您需要创建此脚本并保存它。
qsub my_script.sh因此,如果这个脚本名为blast_AE004437.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:
#!/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}.txtYou need to create this script and save it.
qsub my_script.shSo if this script was called blast_AE004437.sh we could run the following to make all of those steps happen.
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 scriptOften you also need to set the $PATH variable and $PYTHONPATH variable manually before you can call python.
更多推荐
发布评论