Example #1
0
def main():
    args = parse_arguments()

    customize_config(args.num_peloton_instance)

    command = args.command

    if command == "setup":
        applications = {
            HOST_MANAGER: args.disable_peloton_hostmgr,
            RESOURCE_MANAGER: args.disable_peloton_resmgr,
            PLACEMENT_ENGINE: args.disable_peloton_placement,
            JOB_MANAGER: args.disable_peloton_jobmgr,
            ARCHIVER: args.disable_peloton_archiver,
            AURORABRIDGE: args.disable_peloton_aurorabridge,
        }

        global zk_url
        zk_url = args.zk_url
        setup(
            disable_mesos=args.disable_mesos,
            enable_peloton=args.enable_peloton,
            applications=applications,
            enable_k8s=args.enable_k8s,
        )
    elif command == "teardown":
        teardown()
    else:
        # Should never get here.  argparser should prevent it.
        print_utils.fail("Unknown command: %s" % command)
        return 1
Example #2
0
def create_cassandra_store(config):
    retry_attempts = 0
    while retry_attempts < utils.max_retry_attempts:
        time.sleep(utils.sleep_time_secs)
        setup_exe = cli.exec_create(
            container=config["cassandra_container"],
            cmd="/files/setup_cassandra.sh",
        )
        show_exe = cli.exec_create(
            container=config["cassandra_container"],
            cmd='cqlsh -e "describe %s"' % config["cassandra_test_db"],
        )
        # by api design, exec_start needs to be called after exec_create
        # to run 'docker exec'
        resp = cli.exec_start(exec_id=setup_exe)
        if resp is "":
            resp = cli.exec_start(exec_id=show_exe)
            if "CREATE KEYSPACE peloton_test WITH" in resp:
                print_utils.okgreen("cassandra store is created")
                return
        print_utils.warn("failed to create cassandra store, retrying...")
        retry_attempts += 1

    print_utils.fail("Failed to create cassandra store after %d attempts, "
                     "aborting..." % utils.max_retry_attempts)
    sys.exit(1)
Example #3
0
def main():
    args = parse_arguments()
    config = utils.default_config()
    config = customize_config(config, args.num_peloton_instance)

    command = args.command

    if command == "setup":
        disabled_applications = {
            minicluster.HOST_MANAGER: args.disable_peloton_hostmgr,
            minicluster.RESOURCE_MANAGER: args.disable_peloton_resmgr,
            minicluster.PLACEMENT_ENGINE: args.disable_peloton_placement,
            minicluster.JOB_MANAGER: args.disable_peloton_jobmgr,
            minicluster.ARCHIVER: args.disable_peloton_archiver,
            minicluster.AURORABRIDGE: args.disable_peloton_aurorabridge,
            minicluster.MOCK_CQOS: args.disable_peloton_mockcqos,
        }

        cluster = minicluster.Minicluster(
            config,
            disable_mesos=args.disable_mesos,
            enable_k8s=args.enable_k8s,
            enable_peloton=args.enable_peloton,
            disabled_applications=disabled_applications,
            use_host_pool=args.use_host_pool,
            zk_url=args.zk_url,
        )
        cluster.setup()
    elif command == "teardown":
        cluster = minicluster.Minicluster(config)
        cluster.teardown()
    else:
        # Should never get here.  argparser should prevent it.
        print_utils.fail("Unknown command: %s" % command)
        return 1