光泽上的批处理作业不起作用:awk:cmd。 line:1 "unexpected newline or end of string"

Batch job on lustre is not working: awk: cmd. line:1 "unexpected newline or end of string"

我最近在 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

这类似于此处 'Pulling data from the ith line of a file' 节中给出的示例中的语法:http://wiki.gridengine.info/wiki/index.php/Simple-Job-Array-Howto.

有人可以就错误消息的含义提出建议(我不明白为什么在我的代码中间指向 'newline or end of string' 警告),以及如何解决这个问题?我确定这是我错误地进行的一个微不足道的更改,因为它在早些时候工作。

您遇到错误:

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)

我明白了为什么 SGE_TASK_ID 没有设置。我是 运行 使用

的 shell 脚本
./shell.sh

而不是使用

将其提交到队列
qsub shell.sh

所以完全是初学者的错误。