def main(): common.parser().add_option("--indb", dest="indb", help="Input database") if not common.init(__file__): exit(2) progname = common.progname() indb = common.options().indb if not indb: indb = common.testdir() + "/pgn/Kramnik.pgn" temppgn1 = common.tmpdir() + "/copydb1.pgn" temppgn2 = common.tmpdir() + "/copydb2.pgn" tempcfdb1 = common.tmpdir() + "/copydb1.cfdb" if run(1, indb, tempcfdb1) and run(2, tempcfdb1, temppgn1) and run(3, indb, temppgn2): # temppgn1 and temppgn2 should be identical if os.path.exists(temppgn1) and os.path.exists(temppgn2): lines1 = open(temppgn1, "U").readlines() lines2 = open(temppgn2, "U").readlines() diff = difflib.unified_diff(lines1, lines2) different = False first = True for line in diff: if first: print "{0}: PGN files {1} and {2} are different:".format(progname, temppgn1, temppgn2) different = True first = False print line if not different: print "{0}: Test successful".format(progname) else: print "{0}: Failed; no output files to compare".format(progname)
def main(): parser = optparse.OptionParser() do = browsers.Do(parser, execute=False) cmd = browsers.Command(parser, ['ls'], binarypath='/bin') rang = browsers.Range(parser, nruns=11) schema = browsers.Dynamic(parser) sample = browsers.Sample(parser, [("PROBLEM1", "domain1", "instance1")]) core = browsers.Sequential(parser) pop = browsers.Pop(parser, [1, 2, 4, 8, 16, 32, 64, 128]) execute = browsers.Execute(parser, seed=1) start = browsers.Restart(parser, restart=True) common.parser(parser) do\ .add(sample)\ .add(rang)\ .add(cmd)\ .add(schema)\ .add(core)\ .add(pop)\ .add(start)\ .add(execute) do()
def main(): common.parser().add_option("--indb", dest = "indb", help = "Input database") common.parser().add_option("--outdb", dest = "outdb", help = "Output database") common.parser().add_option("--firstgame", dest="firstgame", help = "First game in input database to analyze") common.parser().add_option("--lastgame", dest="lastgame",help = "First game in input database to analyze") common.parser().add_option("--ecofile", dest = "ecofile", help = "The (.cfdb) database containing the ECO classification") if not common.init(__file__): exit(2) progname = common.progname() debuglog = True logcomms = False logfile1 = common.tmpdir() + "/ccore1.log" logfile2 = common.tmpdir() + "/ccore2.log" configfile = common.configfile() indb = common.options().indb if not indb: indb = common.testdir() + "/pgn/Boris_Spassky.pgn" outdb = common.options().outdb if not outdb: outdb = common.tmpdir() + "/classified.cfdb" if os.path.exists(outdb): os.remove(outdb) ecofile = common.options().ecofile if not ecofile: ecofile = common.testdir() + "/cfdb/eco.cfdb" firstgame = common.options().firstgame lastgame = common.options().lastgame if os.path.exists(logfile1): os.remove(logfile1) if os.path.exists(logfile2): os.remove(logfile2) # Take a copy of the database cmdline = common.ccore() if debuglog: cmdline += " --debuglog true" if logcomms: cmdline += " --logcomms true" if firstgame: cmdline += " -n {0}".format(firstgame) if lastgame: cmdline += " -N {0}".format(lastgame) cmdline += " -l {0} -i {1} -o {2} copydb".format(logfile1, indb, outdb); if common.runccore(cmdline): common.checkLogfile(logfile1) # And then classify the copy cmdline = common.ccore() if debuglog: cmdline += " --debuglog true" if logcomms: cmdline += " --logcomms true" cmdline += " -l {0} -i {1} -E {2} classify".format(logfile2, outdb, ecofile) if common.runccore(cmdline): common.checkLogfile(logfile2)
def main(): parser = optparse.OptionParser() parser.add_option('-d', '--domain', help='domain name to create') parser.add_option('-p', '--path', default='.', help='path where to create the web space') parser.add_option('-P', '--password', default='', help='an encrypted password, as returned by crypt(3) for the ftp access') options = common.parser(parser) create_web(options)
def top(): args = parser().parse_args(sys.argv[1:]) logs = parse_logs(args.logs_list) logs = filter_logs(logs, args) logs = sort_logs(logs, args) if args.limit is not None: logs = logs[:args.limit] print_logs(logs, filler=args.filler, output=args.output, json_flag=args.json)
def main(): common.parser().add_option("--indb", dest = "indb", help = "Input database") common.parser().add_option("--outdb", dest = "outdb", help = "Output database") if not common.init(__file__): exit(2) progname = common.progname() debuglog = True logfile1 = common.tmpdir() + "/ccore1.log" logfile2 = common.tmpdir() + "/ccore2.log" indb = common.options().indb if not indb: indb = common.rootdir() + "/doc/OpeningClassification/eco.pgn" outdb = common.options().outdb if not outdb: outdb = common.testdir() + "/cfdb/eco.cfdb" if os.path.exists(logfile1): os.remove(logfile1) if os.path.exists(logfile2): os.remove(logfile2) if os.path.exists(outdb): os.remove(outdb) # Copy the database cmdline = common.ccore() if debuglog: cmdline += " --debuglog true" cmdline += " -l {0} -i {1} -o {2} copydb".format(logfile1, indb, outdb) if common.runccore(cmdline): common.checkLogfile(logfile1) # Create the opening tree in the output database cmdline = common.ccore() if debuglog: cmdline += " --debuglog true" cmdline += " -l {0} -i {1} -d 100 buildoptree".format(logfile2, outdb) if common.runccore(cmdline): common.checkLogfile(logfile2)
def main(): common.parser().add_option("--epdfile", dest = "epdfile", help = "Input EPD file") common.parser().add_option("--timecontrol", dest="timecontrol", default = "10s", help = "Time control") common.parser().add_option("--engine", dest="engine", help = "The engine to use to process the EPD file") if not common.init(__file__): exit(2) progname = common.progname() debuglog = True logcomms = False logfile = common.tmpdir() + "/ccore.log" configfile = common.configfile() epdfile = common.options().epdfile if not epdfile: usage() timecontrol = common.options().timecontrol engine = common.options().engine if not engine: engine = common.engine1() if os.path.exists(logfile): os.remove(logfile) # Take a copy of the database cmdline = common.ccore() if debuglog: cmdline += " --debuglog true" if logcomms: cmdline += " --logcomms true" cmdline += " -c {0} -l {1} -e {2} -t {3} processepd {4}".format(configfile, logfile, epdfile, timecontrol, engine); if common.runccore(cmdline): common.checkLogfile(logfile)
logger = logging.getLogger("make_experience") parser = optparse.OptionParser() parser.add_option('-n', '--name', default='EXP', help='give an experience name') parser.add_option('-b', '--binary', default='', help='give the path to the binary to make an experience') parser.add_option('-s', '--script', default='', help='give the path to the script to launch experiences') topic = DATE for char in [' ', ':', '-', '.']: topic = topic.replace(char, '_') parser.add_option('-t', '--topic', default=topic, help='give here a topic name used to create the folder') options = common.parser(parser) if __name__ == '__main__': dirname = "%s-%s" % (options.topic, options.name) logger.info("Create experience directory %s ..." % dirname) os.mkdir(dirname) open('%s/README' % dirname, 'w').write("""\ NAME: %(name)s DATE: %(date)s PATH: %(dirname)s """ % {'name': options.name, 'date': DATE,
help='give the path to the binary to make an experience') parser.add_option('-s', '--script', default='', help='give the path to the script to launch experiences') topic = DATE for char in [' ', ':', '-', '.']: topic = topic.replace(char, '_') parser.add_option('-t', '--topic', default=topic, help='give here a topic name used to create the folder') options = common.parser(parser) if __name__ == '__main__': dirname = "%s-%s" % (options.topic, options.name) logger.info("Create experience directory %s ..." % dirname) os.mkdir(dirname) open('%s/README' % dirname, 'w').write("""\ NAME: %(name)s DATE: %(date)s PATH: %(dirname)s """ % { 'name': options.name,
def main(): common.parser().add_option("--engine1", dest = "engine1", help = "Engine #1") common.parser().add_option("--engine2", dest = "engine2", help = "Engine #2") common.parser().add_option("--numgames", dest = "numgames", type = "int", default = 5, help = "Number of games") common.parser().add_option("--timecontrol", dest = "timecontrol", default = "30", help = "Time control") common.parser().add_option("--ecofile", dest = "ecofile", help = "The (.cfdb) database containing the ECO classification") common.parser().add_option("--logcomms", dest = "logcomms", type = "int", default = 0, help = "Log UCI comms") if not common.init(__file__): exit(2) progname = common.progname() debuglog = True logcomms = common.options().logcomms != 0 logfile = common.tmpdir() + "/ccore.log" pgnfile = common.tmpdir() + "/games.pgn" configfile = common.configfile() ecofile = common.options().ecofile if not ecofile: ecofile = common.testdir() + "/cfdb/eco.cfdb" engine1 = common.options().engine1 if not engine1: engine1 = common.engine1() engine2 = common.options().engine2 if not engine2: engine2 = common.engine2() numgames = common.options().numgames timecontrol = common.options().timecontrol if os.path.exists(logfile): os.remove(logfile) cmdline = common.ccore() if debuglog: cmdline += " --debuglog true" if logcomms: cmdline += " --logcomms true" cmdline += " -c {0} -l {1} -o {2} -E {3} -n {4} -t {5} tournament {6} {7}".format(configfile, logfile, pgnfile, ecofile, numgames, timecontrol, engine1, engine2) if common.runccore(cmdline): common.checkLogfile(logfile)
def count(): args = parser().parse_args(sys.argv[1:]) logs = parse_logs(args.logs_list) logs = filter_logs(logs, args) print(len(logs))