コード例 #1
0
                    help='output version information and exit',
                    version=f'%(prog)s version {version.VERSION}',
                    action='version')

subparsers = parser.add_subparsers(dest='action')

actions = {
    'cat': cat.register(subparsers.add_parser, configuration.add_defaults),
    'config': config.register(subparsers.add_parser,
                              configuration.add_defaults),
    'jobs': jobs.register(subparsers.add_parser, configuration.add_defaults),
    'kill': kill.register(subparsers.add_parser, configuration.add_defaults),
    'ls': ls.register(subparsers.add_parser, configuration.add_defaults),
    'show': show.register(subparsers.add_parser, configuration.add_defaults),
    'ssh': ssh.register(subparsers.add_parser, configuration.add_defaults),
    'submit': submit.register(subparsers.add_parser,
                              configuration.add_defaults),
    'tail': tail.register(subparsers.add_parser, configuration.add_defaults),
    'usage': usage.register(subparsers.add_parser, configuration.add_defaults),
    'wait': wait.register(subparsers.add_parser, configuration.add_defaults)
}


def load_target_clusters(config_map, url=None, cluster=None):
    """Given the config and (optional) url and cluster flags, returns the list of clusters to target"""
    if cluster and url:
        raise Exception(
            'You cannot specify both a cluster name and a cluster url at the same time'
        )

    clusters = None
    config_clusters = config_map.get('clusters')
コード例 #2
0
parser.add_argument('--config', '-C', help='the configuration file to use')
parser.add_argument('--silent',
                    '-s',
                    help='silent mode',
                    dest='silent',
                    action='store_true')
parser.add_argument('--verbose',
                    '-v',
                    help='be more verbose/talkative (useful for debugging)',
                    dest='verbose',
                    action='store_true')

subparsers = parser.add_subparsers(dest='action')

actions = {
    'submit': submit.register(subparsers.add_parser, add_defaults),
    'show': show.register(subparsers.add_parser, add_defaults),
    'wait': wait.register(subparsers.add_parser, add_defaults),
    'list': list.register(subparsers.add_parser, add_defaults)
}


def load_target_clusters(config, url=None, cluster=None):
    """Given the config and (optional) url and cluster flags, returns the list of clusters to target"""
    if cluster and url:
        raise Exception(
            'You cannot specify both a cluster name and a cluster url at the same time'
        )

    clusters = None
    config_clusters = config.get('clusters')