捕获 sbatch 文件输出

Capture a sbatch file output

我希望能够 运行 bash 文件中的命令并将其保存在 somefile.txt

我运行按以下方式编写我的脚本:

目标:在使用 sbatch

启动作业时捕获特定终端命令的输出

当前工作解决方案:

  1. 创建一个 python 函数来执行您要执行的任务
  2. 调用bash文件中的函数
  3. 生成输出文件

示例:

#!/bin/bash

#SBATCH --job-name application1
#SBATCH --partition=TSA
#SBATCH --nodelist=node52

module load openmpi/1.10.2/gcc/4.9.3

mpirun  -np 1  NASA.IS

# I have placed the python call at the end because I want to capture 
# the time it took for the application to run and save it to a file
# I was able to code everything inside the python file and generate the
# corresponding data

python outputCollector.py