afab2f8e49e5855e3531b34ffc95ea348cedc05b mspeir Wed Jan 29 11:24:03 2020 -0800 Fixing issue with head -1 after the ls causing pipefail. The pipefail trigger was causing the script to exit early and produce no results. The awk command after ls shouldn't have this issue. Also simplifying the method for finding the name of the previous log file. refs #24811 diff --git src/utils/qa/qaAutoTrack.sh src/utils/qa/qaAutoTrack.sh index 19ecebf..4b31b1d 100755 --- src/utils/qa/qaAutoTrack.sh +++ src/utils/qa/qaAutoTrack.sh @@ -199,69 +199,67 @@ if [[ "$newLogDir" != "" ]] then # Set logDir if newLogDir is provided logDir="$newLogDir" fi if [[ $overwriteLogUrl == true ]] then # Overwrite url if option is set logUrl=$logDir fi # set currLogFile currLogFile="$db.$tableName.$currDate.$currTime.txt" # set info for prevLog -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}') +prevLogFile=$(ls -Lt $logDir | sed -n /$db.$tableName/p | awk '(NR==1)') #initialize output string output="\n$db\n" -if [ -e $logDir/$db.$tableName.$prevLogDate.$prevLogTime.txt ] +if [[ $prevLogFile != "" ]] then - prevLogFile="$logDir/$db.$tableName.$prevLogDate.$prevLogTime.txt" + prevLogFile="$logDir/$prevLogFile" fi # Set tooOld for different tables if [[ "$tableName" == "clinvar" ]] then tooOld=$(date -d "$currDate - 2 months" +%F) elif [[ "$tableName" == "grcIndcidentDb" ]] then tooOld=$(date -d "$currDate - 6 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" ]] then for tbl in clinvarMain clinvarCnv do # Get file name from beta fileName=$(hgsql -Ne "SELECT * FROM $tbl LIMIT 1" $db) # Get table update time from beta tblDate=$(ssh qateam@hgwbeta "date -d '$(stat -Lc '%y' $fileName)' +%F' '%T") MYTEMPFILE=$(mktemp --tmpdir tmp.XXXXXXXXXX.bed) # featureBits doesn't work with bigBeds, need to turn into bed first ssh qateam@hgwbeta "/usr/local/apache/cgi-bin/utils/bigBedToBed $fileName stdout" > $MYTEMPFILE tblCov=$(featureBits -countGaps $db $MYTEMPFILE 2>&1) - outputCovDiff "$prevLogFile" "$tblCov" "$tbl" "$tblDate" # Check for issues with table checkForIssues "$tblDate" "$tooOld" "$tbl" "$percentDiff" rm -f $MYTEMPFILE done # Tests for all other bigBed based autopushed tracks (assuming they don't use remote bigBed files) else fileName=$(hgsql -Ne "SELECT * FROM $tableName LIMIT 1" $db) # Get table update time from beta tblDate=$(ssh qateam@hgwbeta "date -d '$(stat -Lc '%y' $fileName)' +%F' '%T") MYTEMPFILE=$(mktemp --tmpdir tmp.XXXXXXXXXX.bed) # featureBits doesn't work with bigBeds, need to turn into bed first ssh qateam@hgwbeta "/usr/local/apache/cgi-bin/utils/bigBedToBed $fileName stdout" > $MYTEMPFILE tblCov=$(featureBits -countGaps $db $MYTEMPFILE 2>&1)