dcbac768dccd258dcad4034ab114f3185dc262e1 steve Fri Dec 20 12:52:25 2013 -0800 Made commenting changes diff --git src/utils/qa/copyHgcentral src/utils/qa/copyHgcentral index 61f947f..75f7839 100755 --- src/utils/qa/copyHgcentral +++ src/utils/qa/copyHgcentral @@ -92,41 +92,33 @@ dbDb1 = chopper(openFile("dbDb." + dbDbAssembly + ".hgcentralbeta"), "split", "\t") dbDb2 = chopper(openFile("dbDb." + dbDbAssembly + ".hgcentral"), "split", "\t") for i in range(0,len(dbDbList)): if dbDb1[i] != dbDb2[i]: diffList.append(i) print dbDbOrig + ":" for i in range(0,len(diffList)): print dbDbList[diffList[i]], "=", dbDb1[diffList[i]] print "\n" + dbDbDest + ":" for i in range(0,len(diffList)): print dbDbList[diffList[i]], "=", dbDb2[diffList[i]] print def runTest(testOptions, testTable, testField1, testField2, testOrder): - """This is the main function. In test mode, it queries all three servers - and tests for special cases. It outputs the state of all three servers - and any relevant error messages. In execute mode, it checks to make - sure test mode has been run first. If test mode has not been run, it - forces the user to run test mode. If the data has changed on any server - since test mode was run, it forces the user to run test mode again. If - the data is identical between the origin and destination, it doesn't copy - anything. If the data is different between the origin and destination, - it informs the user and makes the user respond before copying. If the - destination server is blank, it copies the data from the origin to the - destination.""" + """This function handles the running of test mode. In test mode, all three + servers are queried and tested for special cases. The state of all three + servers and any relevant error messages are output.""" fileDev, fileBeta, fileRr = getFilename(testTable, testOptions.assembly) testQuery = "select * from " + testTable + " where " + testField1 + "='" + \ testField2 + "' order by " + testOrder queryDev = createFile(fileDev, "hgcentraltest", testQuery, "hgwdev") queryBeta = createFile(fileBeta, "hgcentralbeta", testQuery, "mysqlbeta") queryRr = createFile(fileRr, "hgcentral", testQuery, "genome-centdb") if queryDev == "" and queryBeta == "" and queryRr == "": printHeader(testTable) print "*** There is no", testTable, "data for", testOptions.assembly + ". Check to make " \ "sure you typed the\nassembly name properly. ***\n\n" return printOutput(testTable, queryDev, queryBeta, queryRr) if queryDev != queryBeta: print "*** There are", testTable, "differences between dev and beta ***" if testTable == "dbDb" and queryDev != "" and queryBeta != "": @@ -135,30 +127,38 @@ print else: print "*** The", testTable, "data on dev and beta is identical ***\n" if queryBeta != queryRr: print "*** There are", testTable, "differences between beta and rr ***" if testTable == "dbDb" and queryBeta != "" and queryRr != "": parseDbDb("beta", "rr", testOptions.assembly) else: print else: print "*** The", testTable, "data on beta and rr is identical ***\n" print def runExecute(execOptions, execTable, execField1, execField2, execOrder): + """This function handles the running of execute mode. If test mode has not + been run first, the user is forced to run test mode. If the data has + changed on any server since test mode was run, the user is forced to run + test mode again. If the data is identical between the origin and destination, + no data is copied. If there are data differences between the origin and destination, + the user is informed and forced to respond before anything is copied. If the + destination server is blank, the data is copied from the origin to the + destination.""" fileTestDev, fileTestBeta, fileTestRr = getFilename(execTable, execOptions.assembly) execQuery = "select * from " + execTable + " where " + execField1 + "='" + \ execField2 + "' order by " + execOrder cladeQuery = "select clade from genomeClade where genome='" + execField2 + "' limit 1" cladeBetaQuery = "select distinct(clade) from genomeClade order by clade" deleteQuery = "delete from " + execTable + " where " + execField1 + "='" + execField2 + "'" loadQueryBeta = "load data local infile '" + fileTestDev + "' into table " + execTable loadQueryRr = "load data local infile '" + fileTestBeta + "' into table " + execTable activeZeroQuery = "update dbDb set active=0 where name='" + execField2 + "'" if not os.path.isfile(fileTestDev) or not os.path.isfile(fileTestBeta) or not \ os.path.isfile(fileTestRr): printHeader(execTable) print "*** Test mode must be run before execute mode. If test mode was already " \ "run, it is\npossible that one of the output files was deleted. Please " \ "re-run test mode. ***\n\n"