Esempio n. 1
0
def init_db(logfile, logtype):
    global configuration, dbase, dbfile
    filename = dbfile % (logfile, logtype)
    if not os.path.exists(filename):
        print "Init local database for %s" % logtype.upper()
        dbase = shelve.open(filename, 'c')
        for s in configuration.listRobots:
            key = os.path.basename(s)
            dbase[key] = [0, 0, 0, 0]
        dbase.sync()
    else:
        dbase = shelve.open(filename, 'w')
    CrobotsLibs.test_connection()
Esempio n. 2
0
    for a in ['f2f', '3vs3', '4vs4']:
        cleanup(configuration.label, a)
        if CrobotsLibs.DATABASE_ENABLE: CrobotsLibs.clean_up(a)
    close_db()
    raise SystemExit

if action == 'setup':
    for a in ['f2f', '3vs3', '4vs4']:
        cleanup(configuration.label, a)
        init_db(configuration.label, a)
        init_status(a)
    close_db()
    raise SystemExit

if action == 'test':
    CrobotsLibs.test_connection()
    CrobotsLibs.close_connection()
    print 'Test completed!'
    raise SystemExit

if check_stop_file_exist():
    print 'Crobots.stop file found! Exit application.'
    close_db()
    raise SystemExit


def run_tournament(ptype, matchParam):
    global tmppath, logpath, robotPath, configuration, crobotsCmdLine
    print '%s Starting %s... ' % (time.ctime(), ptype.upper())
    clean_up_log_file('%s/%s_%s.log' % (logpath, configuration.label, ptype))
    param = crobotsCmdLine % matchParam