计算化学公社

标题: 求助:LSF提交任务脚本使用变量作为Jobname提交 [打印本页]

作者
Author:
伞阳    时间: 2022-8-27 17:08
标题: 求助:LSF提交任务脚本使用变量作为Jobname提交
本帖最后由 伞阳 于 2022-8-27 18:45 编辑

这是一般的LSF脚本:
  1. #!/bin/bash
  2. #BSUB -J myjobname          ##任务名称
  3. #BSUB -q bladeQ
  4. #BSUB -n 28
  5. #BSUB -o out%J.txt            ##标准输出stdout
  6. #BSUB -e error%J.txt          ##标准错误stderr
  7. #BSUB -R "span[hosts=1]"
  8. ...
复制代码

我希望stdout和stderr两个文件名和任务名称一致,而不是使用%J(作业编号)标记该输出:out1444.txt, error1444.txt。希望这两个文件跟随我的任务文件名,比如myjobname_out1444.txt/myjobname_error1444.txt。我查了手册,只查到%T,%X,%I,但都不是我想要的任务名称,好像有环境变量是$LSB_JOBNAME(不确定)。

我的想法是提交任务前定义一个变量Jobname=myjobname,然后在后面使用,像这样:
  1. #!/bin/bash
  2. Jobname=myjobname

  3. #BSUB -J $Jobname                            ##任务名称
  4. #BSUB -q bladeQ
  5. #BSUB -n 28
  6. #BSUB -o $Jobname_out%J.txt            ##标准输出stdout
  7. #BSUB -e $Jobname_error%J.txt          ##标准错误stderr
  8. #BSUB -R "span[hosts=1]"
  9. ...
复制代码

但是#BSUB又是注释行,这样是不能调用的,请问有什么办法可以解决呢?或者有类似%J能调用任务名称的我忽略了,或者有其他办法吗?
谢谢解答!



作者
Author:
abin    时间: 2022-8-27 17:32
Set a label in your script first.

For loop
For each job
Replace the label to create your script for the job
Submit the script.
If you like, delete the scripts after submit.
Done


作者
Author:
伞阳    时间: 2022-8-27 18:31
abin 发表于 2022-8-27 17:32
Set a label in your script first.

For loop

呃,我没看明白,这怎么还搞起英文了?
作者
Author:
abin    时间: 2022-8-27 19:20
伞阳 发表于 2022-8-27 18:31
呃,我没看明白,这怎么还搞起英文了?

It is easy to type.

Pls check out this link 【Run g09 | 直接运行g09-哔哩哔哩】 https://b23.tv/PqhrKcP

You can create a demo script,
use sed to replace the target
or use $1 to transfer the input file name.






欢迎光临 计算化学公社 (http://ccc.keinsci.com/) Powered by Discuz! X3.3