在slurm脚本中指定git分支

发布于 2025-02-14 01:27:34 字数 841 浏览 1 评论 0原文

我正在远程计算集群上运行slurm作业提交文件。该作业调用了一个git存储库下的一些脚本,该脚本具有两个分支maintest_branch。在远程群集的目录中,我可以使用git Checkout轻松地在两者之间切换。我希望Slurm Job使用test_branch分支。但是,如果我只检查该分支,然后使用sbatch file.sh运行作业提交文件,我可以从输出文件中分辨出它正在使用main的脚本。 (我在test_branch中修复了某些错误,但不是main)。我已经尝试将git Checkout test_branch直接添加到作业提交脚本中,但这并没有改变任何内容。我该如何解决?不确定它是否相关,但是作业提交文件正在运行一个python脚本,在调用脚本之前,我让文件激活特定的conda环境。

编辑: 这是我正在运行的脚本。

# Clear the environment from any previously loaded modules
module purge > /dev/null 2>&1

# Load the module environment I need
module load anaconda 
conda activate my_env

# Checkout the right branch 
git checkout test_branch

# Run the actual python script
python ./my_python_script.py

I am running a slurm job submission file on a remote computing cluster. The job calls some scripts that are under a git repository that has two branches main and test_branch. In my directory on the remote cluster I can easily switch between the two using git checkout. I would like the slurm job to use the test_branch branch. However, if I just checkout that branch and then run the job submission file with sbatch file.sh, I can tell from the output file that it is using the scripts from main (there are certain bugs I fixed in test_branch but not main). I have tried adding git checkout test_branch directly into the job submission script, but that doesn't change anything. How can I fix this? Not sure if its relevant, but the job submission file is running a python script, and before calling the script I have the file activate a specific conda environment.

Edit:
Here is the script I am running.

# Clear the environment from any previously loaded modules
module purge > /dev/null 2>&1

# Load the module environment I need
module load anaconda 
conda activate my_env

# Checkout the right branch 
git checkout test_branch

# Run the actual python script
python ./my_python_script.py

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文