78498eb53c4812986a7a5b16088a11cda788953c steve Wed Jul 9 10:21:30 2014 -0700 Enabled beta -> rr copying (redmine #6508) diff --git src/utils/qa/copyHgcentral src/utils/qa/copyHgcentral index 75f7839..66fd16a 100755 --- src/utils/qa/copyHgcentral +++ src/utils/qa/copyHgcentral @@ -193,95 +193,66 @@ return eraseFirst = 0 clade = "" cladesBeta = "" if execTable == "genomeClade": clade = chopper(callHgsql("hgcentraltest", cladeQuery, "hgwdev"), "strip", "") cladesBeta = chopper(callHgsql("hgcentralbeta", cladeBetaQuery, "mysqlbeta"), "split", "\n") if execOptions.orig == "dev" and execTable == "genomeClade" and \ queryExecuteBeta == "" and clade not in cladesBeta: printOutput(execTable, queryExecuteDev, queryExecuteBeta, queryExecuteRr) print "*** Copying aborted. The", clade, "clade exists only on " \ "dev. Please consult with the\nappropriate engineer to find " \ "the correct clade and priority value for", execOptions.assembly, \ "and\nmanually add this entry to the proper clade on beta. ***\n\n" return -# Uncomment the following line and delete the line below that once copying from beta -> rr is active -# if queryExecuteDest != "": - if execOptions.orig == "dev" and queryExecuteDest != "": + if queryExecuteDest != "": input = "" print while input not in ["yes", "no"]: input = raw_input("The existing " + execTable + " data on " + execOptions.dest + " differs from the " + execTable + " data on " + execOptions.orig + ". If you proceed,\nthis data will be overwritten. " "Are you sure you wish to proceed? (yes/no): "); if input not in ["yes", "no"]: print "\n*** Please respond with 'yes' or 'no' ***\n" if input == "yes": eraseFirst = 1 print else: print printOutput(execTable, queryExecuteDev, queryExecuteBeta, queryExecuteRr) print "*** Copying aborted for", execTable, "***\n\n" return if execOptions.dest == "beta": if eraseFirst == 1: callHgsql("hgcentralbeta", deleteQuery, "mysqlbeta") callHgsql("hgcentralbeta", loadQueryBeta, "mysqlbeta") queryExecuteBeta = chopper(callHgsql("hgcentralbeta", execQuery, "mysqlbeta"), "strip", "") -# Delete the following 3 lines when copying from beta -> rr is active - printOutput(execTable, queryExecuteDev, queryExecuteBeta, queryExecuteRr) - print "***", execTable, "successfully copied from", execOptions.orig, \ - "to", execOptions.dest, "***\n" else: -# Delete the following 22 lines and uncomment the rest when copying from beta -> rr is active - printHeader(execTable) - print "\n *** Automatic copying to hgcentral is currently disabled " \ - "***\n\n *** If you would like to manually copy", execTable, \ - "entries from beta to rr," \ - "\n run the following command: ***\n\n\n" \ - " hgsql -e \"load data local infile '" + fileTestBeta + "' into " \ - "table", execTable + "\" hgcentral -h genome-centdb\n\n" - if queryExecuteRr != "": - print " *** WARNING:", execTable, "on hgcentral already " \ - "contains data for", execOptions.assembly + ".\n If you " \ - "run the above command without first deleting the existing " \ - "\n data from hgcentral, it will create duplicate " \ - "entries. ***\n\n" + if eraseFirst == 1: + callHgsql("hgcentral", deleteQuery, "genome-centdb") + callHgsql("hgcentral", loadQueryRr, "genome-centdb") if execTable == "dbDb": - print " *** If you manually copy dbDb from beta to rr, be sure to " \ - "also set\n active=0 with the following " \ - "command: ***\n\n\n" \ - " hgsql -e \"update dbDb set active=0 where name='" + \ - execOptions.assembly + "'\" hgcentral -h " \ - "genome-centdb\n\n\n" - print " *** If you manually copy", execTable, "from beta to rr, be " \ - "sure to run test mode\n again to verify your changes ***\n" -# if eraseFirst == 1: -# callHgsql("hgcentral", deleteQuery, "genome-centdb") -# callHgsql("hgcentral", loadQueryRr, "genome-centdb") -# if execTable == "dbDb": -# callHgsql("hgcentral", activeZeroQuery, "genome-centdb") -# queryExecuteRr = chopper(callHgsql("hgcentral", execQuery, "genome-centdb"), "strip", "") -# printOutput(execTable, queryExecuteDev, queryExecuteBeta, queryExecuteRr) -# print "***", execTable, "successfully copied from", execOptions.orig, "to", \ -# execOptions.dest, "***\n" -# if execOptions.dest == "rr" and execTable == "dbDb": -# print "*** active set to 0 on rr ***\n" + callHgsql("hgcentral", activeZeroQuery, "genome-centdb") + queryExecuteRr = chopper(callHgsql("hgcentral", execQuery, "genome-centdb"), "strip", "") + printOutput(execTable, queryExecuteDev, queryExecuteBeta, queryExecuteRr) + print "***", execTable, "successfully copied from", execOptions.orig, "to", \ + execOptions.dest, "***\n" + if execOptions.dest == "rr" and execTable == "dbDb": + print "*** active set to 0 on rr ***\n" print def sqlRetrieve(retrieveAssembly, retrieveTable, retrieveField): """Querying defaultDb and genomeClade relies on the genome name rather than the assembly name, so this function is run to obtain the appropriate values to plug into the runQuery function.""" assemblyChop = re.sub(r'\d', '', retrieveAssembly) queryRetrieve = callHgsql("hgcentraltest", "select genome from " + retrieveTable + " where " + retrieveField + " like '" + assemblyChop + "%' limit 1", "hgwdev") return queryRetrieve def main(): parser = argparse.ArgumentParser(prog='copyHgcentral',