def main(): global cachedir, cacheurl numgreenlets = 10 http_port = 8898 serve_files = True from mwlib import argv opts, args = argv.parse(sys.argv[1:], "--no-serve-files --serve-files-port= --serve-files --cachedir= --url= --numprocs=") for o, a in opts: if o == "--cachedir": cachedir = a elif o == "--url": cacheurl = a elif o == "--numprocs": numgreenlets = int(a) elif o == "--no-serve-files": serve_files = False elif o == "--serve-files-port": http_port = int(a) if cachedir is None: sys.exit("nslave: missing --cachedir argument") if serve_files: wsgi_server = start_serving_files(cachedir, http_port) port = wsgi_server.socket.getsockname()[1] if not cacheurl: cacheurl = "http://%s:%s/cache" % (find_ip(), port) print "serving files from %r at url %s" % (cachedir, cacheurl) if not cacheurl: sys.exit("--url option missing") make_cachedir(cachedir) from mwlib.async import slave slave.main(commands, numgreenlets=numgreenlets, argv=args)
def main(): global cachedir, cacheurl numgreenlets = 10 http_port = 8898 serve_files = True from mwlib import argv opts, args = argv.parse(sys.argv[1:], "--no-serve-files --serve-files-port= --serve-files --cachedir= --url= --numprocs=") for o, a in opts: if o == "--cachedir": cachedir = a elif o == "--url": cacheurl = a elif o == "--numprocs": numgreenlets = int(a) elif o == "--no-serve-files": serve_files = False elif o == "--serve-files-port": http_port = int(a) if cachedir is None: sys.exit("nslave.py: missing --cachedir argument") if serve_files: wsgi_server = start_serving_files(cachedir, http_port) port = wsgi_server.socket.getsockname()[1] if not cacheurl: cacheurl = "http://%s:%s/cache" % (find_ip(), port) print "serving files from %r at url %s" % (cachedir, cacheurl) if not cacheurl: sys.exit("--url option missing") make_cachedir(cachedir) from mwlib.async import slave slave.main(commands, numgreenlets=numgreenlets, argv=args)
def main(): global cachedir from mwlib import argv opts, args = argv.parse(sys.argv[1:], "--cachedir=") for o, a in opts: if o=="--cachedir": cachedir = a from mwlib.async import slave slave.main(commands, numgreenlets=32, argv=args)
def main(): global cachedir, cacheurl numgreenlets = 10 import argv opts, args = argv.parse(sys.argv[1:], "--cachedir= --url= --numprocs=") for o, a in opts: if o=="--cachedir": cachedir = a if o=="--url": cacheurl = a if o=="--numprocs": numgreenlets = int(a) if not cacheurl: sys.exit("--url option missing") from mwlib.async import slave slave.main(commands, numgreenlets=numgreenlets, argv=args)