# default stdin and stderr for crobots executable devNull = open(os.devnull) # command line strings robotPath = "%s/%s.ro" crobotsCmdLine = "crobots -m%s -l200000" # countCmdLine = "count -p -t %s/%s_%s >/dev/null 2>&1" dbfile = "db/%s_%s.db" matches = {'f2f': 2, '3vs3': 3, '4vs4': 4} # if True overrides the Configuration class parameters overrideConfiguration = False # number of CPUs / cores CPUs = CrobotsLibs.available_cpu_count() print "Detected %s CPU(s)" % CPUs spawnList = [] def run_crobots(tmppath, logpath, logfile, logtype): "spawn crobots command lines in subprocesses" global spawnList procs = [] # spawn processes for i, s in enumerate(spawnList): try: with open("%s/tmp_%s_%s_%s.log" % (tmppath, logfile, i, logtype), 'w') as tmpfile: procs.append(subprocess.Popen(shlex.split(s), stderr=devNull, stdout=tmpfile)) except OSError, e: print e