cb4fbb9fa0dd10f12642472971a197b2b17a94a3 lrnassar Mon Oct 11 08:36:03 2021 -0700 Adding full path to hgsql util for cron environment. diff --git src/utils/qa/hubPublicAutoUpdate src/utils/qa/hubPublicAutoUpdate index 0061574..91a26c8 100755 --- src/utils/qa/hubPublicAutoUpdate +++ src/utils/qa/hubPublicAutoUpdate @@ -50,31 +50,31 @@ def evaluateServer(serverToQuery): """Evaluate the input server, ensure it is valid and return corresponding hgsqlInputs""" if serverToQuery == 'dev': hgsqlInput = ['','hgcentraltest'] elif serverToQuery == 'hgwbeta': hgsqlInput = ['-h hgwbeta ','hgcentralbeta'] elif serverToQuery == 'rr': hgsqlInput = ['-h genome-centdb ','hgcentral'] else: sys.exit("Server called must be either 'dev', 'hgwbeta', or 'rr'") return(hgsqlInput) def buildPubHubDic(hgsqlInput): """Build a dictionary out of the requested server's hubPublic table""" hubPublicDic = {} - hubPublic = subprocess.run("hgsql "+hgsqlInput[0]+"-e 'select * from hubPublic' "+hgsqlInput[1],\ + hubPublic = subprocess.run("/cluster/bin/x86_64/hgsql "+hgsqlInput[0]+"-e 'select * from hubPublic' "+hgsqlInput[1],\ check=True, shell=True, stdout=subprocess.PIPE, universal_newlines=True) hubPublicOutput = hubPublic.stdout.split('\n')[1:-1] for hub in hubPublicOutput: hub = hub.split('\t') hubPublicDic[hub[0]] = {} hubPublicDic[hub[0]] = {'hubUrl':hub[0],'shortLabel':hub[1],'longLabel':hub[2],\ 'registrationTime':hub[3],'dbCount':hub[4],\ 'dbList':hub[5],'descriptionUrl':hub[5]} return(hubPublicDic) def escapeDoubleQuotesOnLabels(label): """Look for single and double quotes in labels""" if '"' in label: label = label.replace('"','\\"') @@ -119,31 +119,31 @@ if line[0].rstrip().lstrip() == 'genome': while "" in line: line.remove("") currentHub['dbList'].append(line[1].rstrip().lstrip()) else: line = line.split(" ") if line[0].rstrip().lstrip() == 'genome': while "" in line: line.remove("") currentHub['dbList'].append(line[1].rstrip().lstrip()) currentHub['dbCount'] = len(currentHub['dbList']) return(currentHub) def printHgsql(hub,varToEdit,newVarValue,hgsqlInput,testMode): """hgsql command to fix the difference""" - cmd = "hgsql "+hgsqlInput[0]+"-e \"update hubPublic set "+varToEdit+" = '"+str(newVarValue)+ \ + cmd = "/cluster/bin/x86_64/hgsql "+hgsqlInput[0]+"-e \"update hubPublic set "+varToEdit+" = '"+str(newVarValue)+ \ "' where hubUrl = '"+hub+"'\" "+hgsqlInput[1] if not testMode: subprocess.run(cmd, check=True, shell=True, stdout=subprocess.PIPE, universal_newlines=True) print(cmd) def compareResults(hubPublicDic,currentHub,hub,hgsqlInput,testMode): """Compare the hubPublic values to the queried currentHub values and report""" if hubPublicDic[hub]['shortLabel'] != currentHub['shortLabel'].rstrip().lstrip(): printHgsql(hub,'shortLabel',escapeDoubleQuotesOnLabels(currentHub['shortLabel'].rstrip().lstrip()),hgsqlInput,testMode) if hubPublicDic[hub]['longLabel'] != currentHub['longLabel'].rstrip().lstrip(): printHgsql(hub,'longLabel',escapeDoubleQuotesOnLabels(currentHub['longLabel'].rstrip().lstrip()),hgsqlInput,testMode) if int(hubPublicDic[hub]['dbCount']) != int(currentHub['dbCount']):