stdin=open(os.devnull), stdout=PIPE, stderr=STDOUT) for line in iter(p.stdout.readline, ''): #print line, # print to stdout immediately lines.append(line) # capture for later p.stdout.close() return_code = p.wait() for line in lines: message += line #results logfile.write(line) force_write(logfile) if return_code != 0: status = "FAILED" logfile.write( append_time("\nDICe " + build_type + " tests complete ") + "\n") force_write(logfile) return (status, message) if __name__ == "__main__": print "\n--UpdateAndTestDICe.py--\n" log_file = open("UpdateAndTestDICe.log", 'w') log_file.write("DICe update and test " + now() + "\n\n") force_write(log_file) status, message = update_and_test_dice(log_file, "Release") print message print "Log file written to UpdateAndTestDICe.log\n"
def _check_heartbeats(): for (id, metadata) in dataserver_metadata.items(): assert isinstance(metadata, dict) if metadata["status"] != "DEAD" and metadata["heartbeat"] + 15 < now(): logging.warning("Server %s has not check in for 15 seconds, unregistering" % id) _unregister(id, metadata["address"])
if os.name=='nt': command = ["do-test.bat"] else: command = ["./do-test"] lines = [] p = Popen(command, bufsize=1, stdin=open(os.devnull), stdout=PIPE, stderr=STDOUT) for line in iter(p.stdout.readline, ''): #print line, # print to stdout immediately lines.append(line) # capture for later p.stdout.close() return_code = p.wait() for line in lines: message += line #results logfile.write(line) force_write(logfile) if return_code != 0: status = "FAILED" logfile.write(append_time("\nDICe " + build_type + " tests complete ")+"\n") ; force_write(logfile) return (status, message) if __name__ == "__main__": print "\n--UpdateAndTestDICe.py--\n" log_file = open("UpdateAndTestDICe.log", 'w') log_file.write("DICe update and test " + now() + "\n\n") ; force_write(log_file) status, message = update_and_test_dice(log_file, "Release") print message print "Log file written to UpdateAndTestDICe.log\n"
def exposed_heartbeat(self, id): logging.debug("Received heartbeat from %s" % id) dataserver_metadata[id]["heartbeat"] = now() dataserver_metadata[id]["status"] = "ALIVE"
def exposed_register(self, id, address): logging.info("registered data server %s at %s" % (id, address)) dataserver_metadata[id] = {"address": address, "status": "ALIVE", "heartbeat": now()} logging.info( "List of dataservers is %s" % json.dumps(dataserver_metadata, indent=4, separators=(',', ':')))
print " compiling..." logfile.write(append_time("\nBuilding Trilinos")+"\n") ; force_write(logfile) os.chdir(trilinos_build_dir) if os.name=='nt': command = ["do-make.bat"] else: command = ["./do-make"] p = Popen(command, stdout=logfile, stderr=logfile) return_code = p.wait() force_write(logfile) msg = "Trilinos " + build_type + " build: Passed\n" if return_code != 0: msg = "Trilinos " + build_type + " build: FAILED\n" status = "FAILED" logfile.write(msg) ; force_write(logfile) message += msg logfile.write(append_time("\nTrilinos build complete")+"\n") ; force_write(logfile) return (status, message) if __name__ == "__main__": print "\n--UpdateTrilinos.py--\n" log_file = open("UpdateTrilinos.log", 'w') log_file.write("Trilinos update " + now() + "\n\n") ; force_write(log_file) status, message = update_trilinos(log_file, "Debug") print message status, message = update_trilinos(log_file, "Release") print message print "Log file written to UpdateTrilinos.log\n"
import os import stat import glob import smtplib from email.mime.text import MIMEText from Utils import now, append_time, force_write from UpdateTrilinos import update_trilinos from UpdateAndTestDICe import update_and_test_dice from PackageDICe import package_dice from LocalDefinitions import MACHINE_NAME, OPERATING_SYSTEM, LOG_FILE_DIRECTORY, TRILINOS_ACTIVE_CONFIGS, DICE_ACTIVE_CONFIGS, DICE_PKG_CONFIGS if __name__ == "__main__": distribution_list = ['*****@*****.**'] status = "Passed" message = "DICe nightly testing on " + MACHINE_NAME + " " + OPERATING_SYSTEM + " " + now( ) + "\n\n" logfile = open( LOG_FILE_DIRECTORY + 'NightlyTesting-' + str(date.today()) + '.log', 'w') NUM_CONFIGS = len(TRILINOS_ACTIVE_CONFIGS) + len( DICE_ACTIVE_CONFIGS) + len(DICE_PKG_CONFIGS) print "Total configurations: " + str(NUM_CONFIGS) CURRENT_INDEX = 1 for test_name in TRILINOS_ACTIVE_CONFIGS: STAT = float(CURRENT_INDEX) / float(NUM_CONFIGS) * 100.0 print "[" + str( int(STAT)) + "%] Building Trilinos configuration: " + test_name result, msg = update_trilinos(logfile, test_name) if result != "Passed":
import os import stat import glob import smtplib from email.mime.text import MIMEText from Utils import now, append_time, force_write from UpdateTrilinos import update_trilinos from UpdateAndTestDICe import update_and_test_dice from PackageDICe import package_dice from LocalDefinitions import MACHINE_NAME, OPERATING_SYSTEM, LOG_FILE_DIRECTORY, TRILINOS_ACTIVE_CONFIGS, DICE_ACTIVE_CONFIGS, DICE_PKG_CONFIGS if __name__ == "__main__": distribution_list = ['*****@*****.**'] status = "Passed" message = "DICe nightly testing on " + MACHINE_NAME + " " + OPERATING_SYSTEM + " " + now() + "\n\n" logfile = open(LOG_FILE_DIRECTORY+'NightlyTesting-'+str(date.today())+'.log', 'w') NUM_CONFIGS = len(TRILINOS_ACTIVE_CONFIGS) + len(DICE_ACTIVE_CONFIGS) + len(DICE_PKG_CONFIGS) print "Total configurations: " + str(NUM_CONFIGS) CURRENT_INDEX = 1 for test_name in TRILINOS_ACTIVE_CONFIGS: STAT = float(CURRENT_INDEX)/float(NUM_CONFIGS) * 100.0 print "[" + str(int(STAT)) +"%] Building Trilinos configuration: " + test_name result, msg = update_trilinos(logfile, test_name) if result != "Passed": status = result message += msg + "\n" CURRENT_INDEX = CURRENT_INDEX + 1