[torqueusers] How to catch PBS environment variables in executing
time
George Wm Turner
turnerg at indiana.edu
Tue Jul 8 04:56:03 MDT 2008
Xin,
You need to escape some of the $ being written by serialjob.
I think what you want is:
cat << EOJ | qsub -
#!/bin/bash -l
#PBS -l nodes=1:ppn=1,walltime=00:03:00
#PBS -o $JOBNAME.out.\$PBS_JOBID
#PBS -e $JOBNAME.err.\$PBS_JOBID
#PBS -N $JOBNAME
#PBS -V
printenv
echo PWD
pwd
echo \$PBS_O_WORKDIR
echo "PBS_JOBID!!!!!!!!!\$PBS_JOBID@@@@@ \$SCRIPTNAME"
echo \$PBS_O_WORKDIR
echo \$PBS_JOBNAME
echo \$PBS_JOBID
echo \$PBS_O_HOME
echo \$PBS_O_LOGNAME
echo \$PBS_O_MAIL
echo `pwd`
$QARGS
EOJ
Note how I didn't escape the $JOBNAME, I think you do want to express
the variable there but not the PBS variables until runtime. Stop by
my cube and we can discuss this.
george wm turner
high performance systems
812 855 5156
On Jul 8, 2008, at 5:57 AM, Hong, Xin wrote:
> Hello Groups,
>
> We are converting a shell script that generates Loadleveler submit
> scripts to PBS. I found all the environment variables during the
> executing time are missed, although I still can successfully submit
> and run the job. For example, $PBS_O_JOBID only can be caught within
> a PBS submission script itself, or can be print out during executing
> time, but cannot be caught in the script that generates the PBS
> script.
>
> Here is the script and a example output.
>
> xinhong at BigRed:/N/soft/linux-rhel4-x86_64/local-utils/bin> more
> serialjob4
> #! /bin/bash
> ......omit part that catch parameters from command line......
> source quoteargs
> # get program options from
> command line
> quoteSOMEcmd "$WANTED" "$@"
>
> ## 2006-10-06: Temporary fix -- using account_no = NONE for now -AG
> ## 2006-11-08: Added account_no and wallclock parameters -AG
> cat <<EOJ | qsub -
> #!/bin/bash -l
> #PBS -l nodes=1:ppn=1,walltime=00:03:00
> #PBS -o $JOBNAME.out.$PBS_JOBID
> #PBS -e $JOBNAME.err.$PBS_JOBID
> #PBS -N $JOBNAME
> #PBS -V
>
> printenv
> echo PWD
> pwd
> echo $PBS_O_WORKDIR
> echo "PBS_JOBID!!!!!!!!!$PBS_JOBID@@@@@ $SCRIPTNAME"
> echo $PBS_O_WORKDIR
> echo $PBS_JOBNAME
> echo $PBS_JOBID
> echo $PBS_O_HOME
> echo $PBS_O_LOGNAME
> echo $PBS_O_MAIL
> echo `pwd`
> $QARGS
>
> EOJ
>
>
> xinhong at Quarry: ~/test> more sj4.out.
> LPATH=
> MANPATH=/N/soft/linux-rhel4-x86_64/intel/cce/10.0.025/man:/N/soft/
> linux-rhel4-x86_64/intel/fce/10.0.025/man:/N/soft/linux-rhe
> l4-x86_64/openmpi-1.2.3/man:/N/u/xinhong/Quarry/man:/usr/local/man:/
> usr/share/man:/usr/X11R6/man:/usr/kerberos/man:/N/soft/li
> nux-rhel4-x86_64/softenv-1.6.2/man:/N/soft/linux-rhel4-x86_64/intel/
> cce/10.1.013/man:/N/soft/linux-rhel4-x86_64/intel/fce/10.
> 1.013/man:/N/soft/linux-rhel4-x86_64/intel/idbe/10.1.013/man:/N/soft/
> linux-rhel4-x86_64/local-utils/man:/N/soft/linux-rhel4-x
> 86_64/nano-1.2.5/man:/N/soft/linux-rhel4-x86_64/moab-5.1.0/man
> HOSTNAME=b029
> SHELL=/bin/bash
> TERM=xterm
> MATLABPATH=
> HISTSIZE=1000
> SSH_CLIENT=::ffff:156.56.195.18 2030 22
> PBS_JOBNAME=sj4
> PERL5LIB=/N/soft/linux-rhel4-x86_64/perl5/5.8.5/lib:/N/soft/linux-
> rhel4-x86_64/perl5/5.8.5/lib/x86_64-linux-thread-multi:/usr
> /lib/perl5/5.8.3/ppc-linux-thread-multi:/usr/lib/perl5/5.8.3:/usr/
> lib/perl5/site_perl/.8.3/ppc-linux-thread-multi:/usr/lib/pe
> rl5/site_perl/5.8.3:/usr/lib/perl5/site_perl:/usr/lib/perl5/
> vendor_perl/5.8.3/ppc-linux-thread-multi:/usr/lib/perl5/vendor_pe
> rl/5.8.3:/usr/lib/perl5/vendor_perl
> FPATH=
> PBS_ENVIRONMENT=PBS_BATCH
> PBS_O_WORKDIR=/N/u/xinhong/Quarry/test
> SSH_TTY=/dev/pts/2
> GTHDATADIR=/N/gpfsbr/xinhong/build/gth-1.0.4-Linux_x86-64-32bit/
> gthdata
> USER=xinhong
> PBS_TASKNUM=1
> LS_COLORS
> =
> no
> =
> 00
> :fi
> =
> 00
> :di
> =
> 01;34
> :ln
> =
> 01;36
> :pi
> =
> 40;33
> :so
> =
> 01;35
> :bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cm
> d
> =
> 01;32
> :*.exe
> =
> 01;32
> :*.com
> =
> 01;32
> :*.btm
> =
> 01;32
> :*.bat
> =
> 01;32
> :*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;3
> 1
> :*.lzh
> =
> 01;31
> :*.zip
> =
> 01;31
> :*.z
> =
> 01;31
> :*.Z
> =
> 01;31
> :*.gz
> =
> 01;31
> :*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;
> 35
> :*.gif
> =01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
> LD_LIBRARY_PATH=/N/soft/linux-rhel4-x86_64/intel/cce/10.0.025/lib:/N/
> soft/linux-rhel4-x86_64/intel/fce/10.0.025/lib:/N/soft/l
> inux-rhel4-x86_64/openmpi-1.2.3/lib:/N/soft/linux-rhel4-x86_64/
> openmpi-1.2.3/lib/openmpi:/N/soft/linux-rhel4-x86_64/intel/cce
> /10.1.013/lib:/N/soft/linux-rhel4-x86_64/intel/fce/10.1.013/lib:/N/
> soft/linux-rhel4-x86_64/openmpi/1.2.5/intel-64/lib
> PBS_O_HOME=/N/u/xinhong/Quarry
> CPATH=/N/soft/linux-rhel4-x86_64/openmpi-1.2.3/include
> PBS_MOMPORT=15003
> PBS_O_QUEUE=batch
> PATH=/N/u/xinhong/Quarry/bin/x86_64:/N/gpfsbr/xinhong/build/
> gth-1.0.4-Linux_x86_64-32bit/bin:/N/soft/linux-rhel4-x86_64/intel
> /cce/10.0.025/bin:/N/soft/linux-rhel4-x86_64/intel/fce/10.0.025/bin:/
> N/soft/linux-rhel4-x86_64/openmpi-1.2.3/bin:/N/u/xinhong
> /Quarry/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/
> kerberos/bin:/N/soft/linux-rhel4-x86_64/softenv-1.6.2/bin:/N/sof
> t/linux-rhel4-x86_64/intel/cce/10.1.013/bin:/N/soft/linux-rhel4-
> x86_64/intel/fce/10.1.013/bin:/N/soft/linux-rhel4-x86_64/inte
> l/idbe/10.1.013/bin:/N/soft/linux-rhel4-x86_64/local-utils/bin:/N/
> soft/linux-rhel4-x86_64/nano-1.2.5/bin:/N/soft/linux-rhel4-
> x86_64/moab-5.1.0/bin:/N/soft/linux-rhel4-x86_64/moab-5.1.0/sbin:/N/
> soft/linux-rhel4-x86_64/mpiblast-1.5.0-pio-openmpi/bin:/N
> /u/xinhong/Quarry/bin
> PBS_O_LOGNAME=xinhong
> MAIL=/var/spool/mail/xinhong
> PBS_JOBCOOKIE=2F6587B62B7A2B886D632B2EB4668F72
> XARCH=x86_64
> SOFTENV_ALIASES=/N/soft/linux-rhel4-x86_64/softenv-1.6.2/etc/softenv-
> aliases.sh
> LD_RUN_PATH=
> PWD=/N/hd01/xinhong/Quarry
> INPUTRC=/etc/inputrc
> PBS_NODENUM=0
> WHATAMI=linux-rhel4-x86_64
> PBS_O_SHELL=/bin/bash
> PBS_SERVER=b001
> LM_LICENSE_FILE=
> PBS_JOBID=443570.qm2
> KRB5CCNAME=FILE:/tmp/krb5cc_52816_7Wp8dF
> ENVIRONMENT=BATCH
> SOFTENV_LOAD=/N/soft/linux-rhel4-x86_64/softenv-1.6.2/etc/softenv-
> load.sh
> TEXINPUTS=
> HOME=/N/u/xinhong/Quarry
> SHLVL=4
> PBS_DEFAULT=m2
> PBS_O_HOST=b001
> IDL_PATH=
> PBS_VNODENUM=0
> LOGNAME=xinhong
> MACHTYPE=x86_64
> PYTHONPATH=
> MPIBLAST_RUN=/N/soft/linux-rhel4-x86_64/openmpi-1.2.3/bin/mpiexec
> SSH_CONNECTION=::ffff:156.56.195.18 2030 ::ffff:149.165.230.1 22
> PBS_QUEUE=serial
> PBS_O_MAIL=/var/spool/mail/xinhong
> LESSOPEN=|/usr/bin/lesspipe.sh %s
> ARCH=linux-rhel4-x86_64
> INFOPATH=/N/soft/linux-rhel4-x86_64/local-utils/info
> SIDL_DLL_PATH=
> G_BROKEN_FILENAMES=1
> BSSMDIR=/N/gpfsbr/xinhong/build/gth-1.0.4-Linux_x86-64-32bit/bssm
> PBS_NODEFILE=/var/spool/torque/aux//443570.qm2
> PBS_O_PATH=/N/u/xinhong/Quarry/bin/x86_64:/N/gpfsbr/xinhong/build/
> gth-1.0.4-Linux_x86_64-32bit/bin:/N/soft/linux-rhel4-x86_64
> /intel/cce/10.0.025/bin:/N/soft/linux-rhel4-x86_64/intel/fce/
> 10.0.025/bin:/N/soft/linux-rhel4-x86_64/openmpi-1.2.3/bin:/N/u/x
> inhong/Quarry/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/
> kerberos/bin:/N/soft/linux-rhel4-x86_64/softenv-1.6.2/bin:
> /N/soft/linux-rhel4-x86_64/intel/cce/10.1.013/bin:/N/soft/linux-
> rhel4-x86_64/intel/fce/10.1.013/bin:/N/soft/linux-rhel4-x86_6
> 4/intel/idbe/10.1.013/bin:/N/soft/linux-rhel4-x86_64/local-utils/
> bin:/N/soft/linux-rhel4-x86_64/nano-1.2.5/bin:/N/soft/linux-
> rhel4-x86_64/moab-5.1.0/bin:/N/soft/linux-rhel4-x86_64/moab-5.1.0/
> sbin:/N/soft/linux-rhel4-x86_64/mpiblast-1.5.0-pio-openmpi/
> bin:/N/u/xinhong/Quarry/bin
> _=/usr/bin/printenv
> PWD
> /N/hd01/xinhong/Quarry
>
> PBS_JOBID!!!!!!!!!@@@@@ serialjob4
>
>
>
>
>
>
> /N/u/xinhong/Quarry/test
> hello world!
> bye
>
> Any suggestion are highly appreciated.
>
> Xin
>
>
> _______________________________________________
> torqueusers mailing list
> torqueusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/torqueusers
More information about the torqueusers
mailing list