@@ -0,0 +1,1874 @@
+#!/usr/bin/env python%0A%22%22%22%0ALaunch a distributed job%0A%22%22%22%0Aimport argparse%0Aimport os, sys%0Aimport signal%0Aimport logging%0A%0Adef main():%0A    parser = argparse.ArgumentParser(description='Launch a distributed job')%0A    parser.add_argument('-n', '--num-workers', required=True, type=int,%0A                        help = 'number of worker nodes to be launched')%0A    parser.add_argument('-s', '--num-servers', type=int,%0A                        help = 'number of server nodes to be launched, %5C%0A                        in default it is equal to NUM_WORKERS')%0A    parser.add_argument('-H', '--hostfile', type=str,%0A                        help = 'the hostfile of slave machines which will run the job')%0A    parser.add_argument('--sync-dir', type=str,%0A                        help = 'if specificed, it will sync the current %5C%0A                        directory into slave machines%5C's SYNC_DIR')%0A    parser.add_argument('--launcher', type=str, default='ssh',%0A                        choices = %5B'ssh', 'mpirun'%5D,%0A                        help = 'the lancher to use')%0A    parser.add_argument('command', nargs='+',%0A                        help = 'command for launching the program')%0A    args, unknown = parser.parse_known_args()%0A%0A    if args.num_servers is None:%0A        args.num_servers = args.num_workers%0A%0A    curr_path = os.path.abspath(os.path.dirname(__file__))%0A    sys.path.append(os.path.join(curr_path, %22../ps-lite/tracker%22))%0A%0A    if args.hostfile is None:%0A        from dmlc_local import LocalLauncher%0A        launcher = LocalLauncher(args, unknown)%0A    elif args.launcher == 'ssh':%0A        from dmlc_ssh import SSHLauncher%0A        launcher = SSHLauncher(args, unknown)%0A    else:%0A        return%0A%0A    launcher.run()%0A%0Adef signal_handler(signal, frame):%0A    logging.info('Stop luancher')%0A    sys.exit(0)%0A%0Aif __name__ == '__main__':%0A%0A    signal.signal(signal.SIGINT, signal_handler)%0A%0A    main()%0A

add tools/launch.py