Hi, Am 13.01.2012 um 02:03 schrieb Reuti:
> <snip> > But a nice solution could be the usage of the job context. This can be set by > the user on the command line, and your job can access this by issuing a > similar command like you did already. If the exechosts are submit hosts, the > job can also change this by using `qalter` like the user has to use on the > command line. We use the job context only for documentation purpose, to > record the issued command and append it to the email which is send after the > job. > > http://gridengine.org/pipermail/users/2011-September/001629.html as the usage of a job context may be a seldom used feature, let me elaborate this and post an example. Imagine you have a jobscript: =================== #!/bin/bash . /usr/sge/default/common/settings.sh STATE_OLD=EMPTY while true; do while read LINE; do case ${LINE%%=*} in STATE) STATE=${LINE#*=} ;; LEVEL) LEVEL=${LINE#*=} ;; esac done < <(qstat -j $JOB_ID | sed -n -e "/^context/s/^context: *//p" | tr "," "\n") if [ "$STATE" != "$STATE_OLD" ]; then STATE_OLD="$STATE" echo "STATE was changed to: $STATE" fi if [ "$STATE" = "EXIT" ]; then break fi sleep 5 done echo "Process completed." exit 0 =================== and you submit this with: $ qsub -ac STATE=INIT test.sh Your job 3686 ("test.sh") has been submitted and after each 5 seconds: $ qalter -sc STATE=PROCESS 3686 modified context of job 3686 $ qalter -sc STATE=COMPRESSION test.sh modified context of job 3686 $ qalter -sc STATE=SAVING 3686 modified context of job 3686 $ qalter -sc STATE=EXIT test.sh modified context of job 3686 In another window you can follow the output: $ tail -f test.sh.o3686 STATE was changed to: INIT STATE was changed to: PROCESS STATE was changed to: COMPRESSION STATE was changed to: SAVING STATE was changed to: EXIT Process completed. By using a job context (which can be changed by the user or by the job itself [and then checked with `qsub -j 12345` on the command line by the user]) the user can influence the operation of the job as well as the job can output its internal state or commenting information, without the need to print it in the output file or the use of any file which you have to change and read. -- Reuti _______________________________________________ users mailing list [email protected] https://gridengine.org/mailman/listinfo/users
