Exemple #1
0
                     type=str,
                     help="disk size",
                     required=True)
    sub.add_argument("-t", "--tag", default="", help="tag of the image to run")
    sub.add_argument("-f",
                     "--force",
                     action="store_true",
                     help="force re-download image in k8s")
    sub.add_argument('project_id', type=str, help='which project to run')
    sub.set_defaults(func=run_on_kubernetes)

    sub = subparsers.add_parser('delete', help='kill the running project')
    sub.add_argument('project_id',
                     type=str,
                     help='which node or nodes to stop running')
    sub.set_defaults(func=delete)

    def selector(args):
        return {'run': 'project'}

    util.add_bash_parser(NAME, subparsers, custom_selector=selector)
    util.add_top_parser(NAME, subparsers, custom_selector=selector)
    util.add_htop_parser(NAME, subparsers, custom_selector=selector)
    util.add_logs_parser(NAME, subparsers)

    util.add_images_parser(NAME, subparsers)

    args = parser.parse_args()
    if hasattr(args, 'func'):
        args.func(args)
Exemple #2
0
    subparsers = parser.add_subparsers(help='sub-command help')

    sub = subparsers.add_parser('build', help='build docker image')
    sub.add_argument("-t", "--tag", required=True, help="tag for this build")
    sub.add_argument("-r", "--rebuild", action="store_true", help="rebuild from scratch")
    sub.add_argument("-l", "--local", action="store_true",
                     help="only build the image locally; don't push it to gcloud docker repo")
    sub.set_defaults(func=build_docker)

    sub = subparsers.add_parser('run', help='create/update {name} daemonset on the currently selected kubernetes cluster'.format(name=NAME), formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    sub.add_argument("-t", "--tag", default="", help="tag of the image to run (or use recent image if not specified)")
    sub.add_argument("-f", "--force",  action="store_true", help="force reload image in k8s")
    sub.set_defaults(func=run_on_kubernetes)


    sub = subparsers.add_parser('delete', help='delete daemonset')
    sub.set_defaults(func=delete)

    selector = f = lambda *args: {'storage':'daemon'}
    util.add_bash_parser(NAME, subparsers,   custom_selector=selector)
    util.add_top_parser(NAME, subparsers,    custom_selector=selector)
    util.add_htop_parser(NAME, subparsers,   custom_selector=selector)
    util.add_logs_parser(NAME, subparsers)
    util.add_images_parser(NAME, subparsers)
    util.add_edit_parser(NAME, subparsers)


    args = parser.parse_args()
    if hasattr(args, 'func'):
        args.func(args)