0

我有foo.sh如下

#!/bin/bash
#SBATCH -A research
#SBATCH -p long
#SBATCH --mem-per-cpu=1024
#SBATCH -N 1
#SBATCH -n 24
#SBATCH -t 2-00:00:00
#SBATCH --mail-type=END
#SBATCH --exclude=node37

module load Gaussian/09revC

export GAUSS_SCRDIR=/scratch/$USER.$SLURM_JOBID
/bin/mkdir -p $GAUSS_SCRDIR

g09 $1

/bin/rm -rf $GAUSS_SCRDIR

foo.sh从另一个名为的 bash 文件中调用submit.sh

#!/bin/bash
sbatch foo.sh 00_molecule_name_some_method.com
sbatch foo.sh 01_molecule_name_some_method.com
sbatch foo.sh 02_molecule_name_some_method.com

这会提交多个作业。

我想更改submit.sh为 Python 文件,该文件将调用foo.sh为它提供将进入的参数$1foo.shPython 不应等待作业完成。

也是我将在 for 循环中提供的molecule_name变量some_method

模板 Python 脚本submit.py

for molecule_name in molecules:
    for some_method in methods:
        foo.sh molecule_name some_method

我收到此错误:

/bin/mkdir: cannot create directory ‘/scratch’: Permission denied
PGFIO/stdio: No such file or directory
PGFIO-F-/OPEN/unit=11/error code returned by host stdio - 2.
File name = /scratch/USERNAME./Gau-41212.inp
In source file ml0.f, at line number 181
PGFIO/stdio: No such file or directory
PGFIO-F-/OPEN/unit=11/error code returned by host stdio - 2.
File name = /scratch/USERNAME./Gau-41213.inp
In source file ml0.f, at line number 181
4

1 回答 1

1

使用子流程

import subprocess
for molecule_name in molecules:
    for some_method in methods:
        command1 = subprocess.Popen(['foo.sh', molecule_name, some_method])
于 2020-04-20T13:48:57.347 回答