df0b2815a68268581da0984e2de1d718a9dcb661 mspeir Wed Jan 11 15:54:16 2017 -0800 Changes based on CR. Added new variables for previous log time and current runtime. Changed log file name format, now includes current runtime in name. Changed way previous log file was found, now can compare to previous logs from the same day. Simplified checks for newLogDir and overwriteLogUrl. refs #18632 diff --git src/utils/qa/qaAutoTrack.sh src/utils/qa/qaAutoTrack.sh index ca30942..722d5dd 100755 --- src/utils/qa/qaAutoTrack.sh +++ src/utils/qa/qaAutoTrack.sh @@ -17,52 +17,53 @@ # - Percentage difference in coverage between now and the last time the script was run # ################################ ##### Variables ##### # Set by command-line options db="" tableName="" bigBedMode="" verboseMode=false overwriteLogUrl=false newLogDir="" # Other variables currDate=$(date +%F) +currTime=$(date +%H_%M_%S) output="" # holds output message logUrl="http://genecats.cse.ucsc.edu/qa/test-results/qaAutoTrackLogs" logDir="/usr/local/apache/htdocs-genecats/qa/test-results/qaAutoTrackLogs" currLogFile="" prevLogFile="" prevLogDate="" # Variables for issue checking issueNote="" tooOld="" percentDiff="" ##### Functions ##### # Usage message function showHelp() { cat << EOF Usage: `basename $0` [-hbvs] [-l log dir] [-u log url] \$database \$table Required arguments: - \$database UCSC database name, i.e. hg19 or hg38. - \$table Table name, i.e. gwasCatalog. + database UCSC database name, e.g. hg19 or hg38. + table Table name, e.g. gwasCatalog. Optional arguments: -h Display this help and exit -b BigBed mode. Used for tracks supported bigBed files, i.e. grcIncidentDb. -v Verbose mode. Outputs test results to standard out as well as file. -l log directory Alternate directory for output log -u log url Alternate URL for output log. -s Suppress URL in output. Will instead print directory in messages. Performs basic QA for auto-pushed tracks, which includes: - Checks when data for track was last updated - Coverage from featureBits -countGaps @@ -183,63 +184,54 @@ # Check number of required arguments if [ $# -ne 2 ] then # Output usage message if number of required arguments is wrong showHelp >&2 exit 1 else # Set variables with required argument values db=$1 tableName=$2 fi ##### Main Program ##### # Set some variables based on optional input -if [[ "$newLogDir" != "" ]] && [[ $overwriteLogUrl == false ]] +if [[ "$newLogDir" != "" ]] then # Set logDir if newLogDir is provided logDir="$newLogDir" -elif [[ "$newLogDir" != "" ]] && [[ $overwriteLogUrl == true ]] -then - # Set both newLogDir and logUrl if newLogDir is provided and option to overwrite url is set - logDir="$newLogDir" - logUrl=$logDir -elif [[ "$newLogDir" == "" ]] && [[ $overwriteLogUrl == true ]] +fi +if [[ $overwriteLogUrl == true ]] then # Overwrite url if option is set logUrl=$logDir fi # set currLogFile -if [ -e "$logDir/$db.$tableName.$currDate.txt" ] -then - # if currLogFile already exists, make a new one w/ current time included in name - currLogFile="$db.$tableName.$currDate.$(date +%H_%M_%S).txt" -else - currLogFile="$db.$tableName.$currDate.txt" -fi +currLogFile="$db.$tableName.$currDate.$currTime.txt" # set info for prevLog -prevLogDate=$(ls -Lt $logDir | sed -n /$db.$tableName/p | grep -v "$currDate" | head -1 | awk -F . '{print $3}') +prevLogDate=$(ls -Lt $logDir | sed -n /$db.$tableName/p | head -1 | awk -F . '{print $3}') +prevLogTime=$(ls -Lt $logDir | sed -n /$db.$tableName/p | head -1 | awk -F . '{print $4}') #initialize output string output="\n$db\n" -if [ -e $logDir/$db.$tableName.$prevLogDate.txt ] +if [ -e $logDir/$db.$tableName.$prevLogDate.$prevLogTime.txt ] then - prevLogFile="$logDir/$db.$tableName.$prevLogDate.txt" + prevLogFile="$logDir/$db.$tableName.$prevLogDate.$prevLogTime.txt" fi # Set tooOld for different tables if [[ "$tableName" == "clinvar" ]] || [[ "$tableName" == "grcIndcidentDb" ]] then tooOld=$(date -d "$currDate - 2 months" +%F) else tooOld=$(date -d "$currDate - 1 month" +%F) fi # Run tests for different tracks if [[ $bigBedMode == "on" ]] then # ClinVar has muliple tables if [[ $tableName == "clinvar" ]]