wiki:ComputeStartExample6

Version 7 (modified by george, 14 years ago) (diff)

--

Script Example

The scripts for analysis operations are generated from templates (Template Example). Every script for execution on a cluster consists of a header and body. Besides other parameters, a cluster header contains information about the maximum operation execution time. Execution will be stopped, if it exceeds the maximum time :

# execution time = 5 hours
#PBS -l walltime=05:00:00 

Additionally, a header contains path to the files, where command-line output and error will be written:

#PBS -e /data/user123/monitor/analysis1/job1_step02.err
#PBS -o /data/user123/monitor/analysis1/job1_step02.out

A script body contains supplementary print-out commands used for logging/monitoring of job execution and a main command line, which is an invokation of an analysis tool.

# convert to ped+map format
# log start-time
printf "gwa1foranalysis_step0_started convert to ped+map format" >>/data/user1/job1/monitor.txt
date "+DATE: %m/%d/%y%tTIME: %H:%M:%S" >>/data/user1/job1/monitor.txt
# analysis
/data/user1/exes/plink --noweb --bfile /data/user1/data/job1/gwa1foranalysis --recode --out /data/user1/data/job1/ped/gwa1foranalysis
#log finish-time
printf "gwa1foranalysis_step0_finished " >>/data/user1/job1/monitor.txt
date "+DATE: %m/%d/%y%tTIME: %H:%M:%S" >>/data/user1/job1/monitor.txt

In this way, we have several level of logging information:

  • about job start and finish time, which is used in workflow management (printing in a script body)
  • about job results, which is used in error-handling (printing in a script header)

Back to Examples