예제 #1
0
def install_package(package_name: str,
                    service_prefix: str,
                    index: int,
                    service_task_count: int,
                    config_path: str,
                    additional_options: dict = None) -> dict:
    if package_name.startswith("beta-"):
        basename = package_name[len("beta-"):]
    else:
        basename = package_name

    service_name = "{}{}-{:0>2}".format(service_prefix, basename, index)

    service_account_info = scale_tests_utils.setup_security(
        service_name, "nobody")

    service_options = scale_tests_utils.get_service_options(
        service_name, service_account_info, additional_options, config_path)

    expected_task_count = service_task_count(service_options)
    log.info("Expected task count: %s", expected_task_count)

    log.info("Installing %s index %s as %s", package_name, index, service_name)
    sdk_install.install(package_name,
                        service_name,
                        expected_task_count,
                        additional_options=service_options,
                        insert_strict_options=False)

    return {
        "package_name": package_name,
        "service_account_info": service_account_info,
        **service_options
    }
예제 #2
0
def install_package(package_name: str,
                    service_prefix: str,
                    index: int,
                    linux_user: str,
                    service_task_count: int,
                    config_path: str,
                    additional_options: typing.Dict = None,
                    quota_options: typing.Dict = None) -> typing.Dict:
    """
    Deploy a single dispatcher with the specified index.
    """

    if package_name.startswith("beta-"):
        basename = package_name[len("beta-"):]
    else:
        basename = package_name

    service_name = "{}{}-{:0>2}".format(service_prefix, basename, index)

    service_account_info = scale_tests_utils.setup_security(
        service_name, linux_user)

    drivers_role = setup_role(service_name, "drivers", quota_options)
    executors_role = setup_role(service_name, "executors", quota_options)

    setup_spark_security(service_name, drivers_role, executors_role,
                         service_account_info)

    service_options = scale_tests_utils.get_service_options(
        service_name, service_account_info, additional_options, config_path)

    # install dispatcher with appropriate role
    service_options["service"]["role"] = drivers_role

    expected_task_count = service_task_count(service_options)
    log.info("Expected task count: %s", expected_task_count)

    log.info("Installing %s index %s as %s", package_name, index, service_name)

    sdk_install.install(package_name,
                        service_name,
                        expected_task_count,
                        timeout_seconds=60 * 60,
                        additional_options=service_options,
                        wait_for_deployment=False,
                        insert_strict_options=False,
                        install_cli=False)

    return {
        "package_name": package_name,
        "roles": {
            "drivers": drivers_role,
            "executors": executors_role
        },
        "service_account_info": service_account_info,
        **service_options
    }