我最近开始在Lustre系统上运行Python批处理作业。
我最近对shell脚本进行了更改,导致错误:
awk: cmd. line:1: NR==
awk: cmd. line:1: ^ unexpected newline or end of string
脚本如下:
#$ -cwd
# Define parallel environment for N cores
#$ -pe openmp 4
# Validation level (e = reject on all problems)
#$ -w e
# Merge stdout and stderr streams: yes/no
#$ -j yes
#name of job (human-friendly)
#$ -N experiment
# array job parameters below:
# which job IDs in the array to run, eg 1-5 or 3
#$ -t 1
# how many jobs of the array to run at a time
#$ -tc 15
MYFILE=all_experiment_parameters.txt.$RANDOM
python Get_Parameter_Settings.py > $MYFILE
SEED=$(awk "NR==$SGE_TASK_ID" $MYFILE)
echo $SEED
python RunExperiment.py $SEED
这类似于“从文件的第i行拉取数据”一节中给出的示例中的语法:http://wiki.gridengine.info/wiki/index.php/Simple-Job-Array-Howto。
有人可以提供有关错误消息含义的建议(我不明白为什么它是'换行符或字符串结尾'的警告,当指向我的代码中间时),以及如何解决这个问题?我确信这是一个微不足道的改变,因为它早先工作了。
答案 0 :(得分:1)
您收到错误:
awk: cmd. line:1: NR==
awk: cmd. line:1: ^ unexpected newline or end of string
因为您的环境变量SGE_TASK_ID
未在脚本的这一行设置:
SEED=$(awk "NR==$SGE_TASK_ID" $MYFILE)
答案 1 :(得分:0)
我已经意识到为什么没有设置SGE_TASK_ID。我正在使用
运行shell脚本./shell.sh
而不是使用
将其提交到队列中qsub shell.sh
这是一个初学者的错误。