Пример #1
0
def build_parser(host_arch, script_name):
    import argparse
    sys_file = util.get_sys_file(host_arch, script_name)
    usage_str = "kslinstall [options] install_file\nSee %s for default options" % (sys_file)
    parser = argparse.ArgumentParser(usage=usage_str)

    parser.add_argument('install_file', type=str, nargs='?', help='install_file specifying install', default='')

    og = parser.add_argument_group("General ")
    
    og.add_argument("--version",
                  action="store_true", default=False,
                  help="print version string and exit")

    og.add_argument("-v", "--verbose",
                  action="store_true", 
                  help="print informational messages to stdout")

    og.add_argument("--dry_run", action="store_true",
                    help="perform a dry run (don't actually execute commands)")
    
    og.add_argument("-f", "--force",
                    action="store_true", 
                    help="clobber target directories and files")
    
    og.add_argument("-k", "--keep_going",
                  action="store_false", dest="errors_fatal",
                  help="Do not abort if any variant builds fail")
    
    og.add_argument("-z", "--interactive",
                  action="store_true", dest="interactive",
                  help="Pause for confirmation on each job step")
    
    og.add_argument('-n', "--no_install",
                 action="store_false", dest="do_install",
                 help="Skip build/install steps (install module files only)")
    
    og.add_argument('-m', "--no_module",
                 action="store_false", dest="do_module", 
                 help="Skip installing modulefiles (build/install steps only)")                      

    og.add_argument("-c", "--module_cmd",
                 action="store", dest="module_cmd",
                 help="module command")

    og = parser.add_argument_group("Input Paths ")

    og.add_argument("--source_paths",
                      action="store", dest="source_paths", type=str,
                      help="source paths to search ")

    og.add_argument("--overlay_paths",
                      action="store", dest="overlay_paths", type=str,
                      help="overlay paths to search")
    
    og.add_argument("--patch_paths",
                      action="store", dest="patch_paths", type=str,
                      help="patch paths to search")

    og.add_argument("-t", "--module_template",
                  action="store", dest="module_template", type=str,
                  help="template module file ")

    og = parser.add_argument_group("Output Paths ")
    
    og.add_argument("-b", "--build_dir",
                  action="store", dest="build_dir", type=str,
                  help="working directory for builds")

    og.add_argument("--root_install_dir",
                  action="store", dest="root_install_dir", type=str,
                  help="root directory to install packages to")
        
    og.add_argument("--root_module_dir",
                  action="store", dest="root_module_dir", type=str,
                  help="root module directory to install modulefiles to")

    return parser
Пример #2
0
def build_parser(host_arch, script_name):
    import argparse
    sys_file = util.get_sys_file(host_arch, script_name)
    usage_str = "kslrun [options] command\nSee %s for default options" % (sys_file)
    parser = argparse.ArgumentParser(usage=usage_str)

    parser.add_argument('command', type=str, nargs='?', help='Command string to forward to mpirun', default='')

    ### Run Options
    og = parser.add_argument_group("General ")
    og.add_argument("--version", action="store_true", default=False,
                  help="print version string and exit")
    og.add_argument("-c", "--configure", action="store_true",
                    help="set up a configure file")
    og.add_argument("--dry_run", action="store_true",
                    help="perform a dry run (don't actually execute commands)")
    og.add_argument("-v", "--verbose", action="store_true", 
                 help="print informational status messages to stdout")

    og.add_argument("-d", "--debug", action="store_true",
                 help="enable debug mode (developer use)")

    og.add_argument("-i", "--interactive", action="store_true",
                 help="request interactive xterm session from queue")

    og.add_argument("-r", "--no_std_redirect", action="store_true",
                 help="disable stdout/stderr redirection")

    og.add_argument("-g", "--generate_only", action="store_true",
                    help="only generate a LoadLeveler file, do nothing else")

    ### LoadLeveler Options
    og = parser.add_argument_group("LoadLeveler")
    og.add_argument('--no_notify', action="store_true",
                 help="do not send a notification email when job completes")

    og.add_argument("--prefix", type=str,
                 help='prefix for output files (only meaningful if no_std_redirect is enabled')
    og.add_argument("-j", "--job_name", type=str,
                 help="job_name as passed to LoadLeveler")

    og.add_argument('-t', "--wall_time", type=str,
                 help="job wall_time as passed to LoadLeveler")

    og.add_argument("-a", "--account", type=str,
                 help="account number to charge")

    og.add_argument("-p", "--partition_size", type=int, 
                  help="number of nodes to request")

    ### MPI Options
    og = parser.add_argument_group("MPI")
    og.add_argument("-n", "--np", type=int,
                 help="number of MPI processes to request")

    ### BGP-specific
    if host_arch == 'ppc64':
        og.add_argument("-m", "--mode", type=str,
                      help="MPI mode to use (e.g. VN, DUAL, SMP)")

        og.add_argument("--map", type=str, dest='map',
                      help="mapping of logical MPI processes to physical nodes/cores (e.g. XYZT, TXYZ, ...)")

    return parser