如何提交一个调用python脚本的SGE作业

2024-10-02 18:18:06 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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.

^{pr2}$

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


Tags: 文件thetorunname脚本bashoutput
1条回答
网友
1楼 · 发布于 2024-10-02 18:18:06

您列出的文件是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。在

相关问题 更多 >