mirror of
https://github.com/wassname/ray.git
synced 2026-07-09 07:27:23 +08:00
[autoscaler] Split autoscaler interface public private (#10898)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from ray.autoscaler.aws.config import _resource_cache
|
||||
from ray.autoscaler._private.aws.config import _resource_cache
|
||||
|
||||
from botocore.stub import Stubber
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ from datetime import datetime
|
||||
|
||||
# Override global constants used in AWS autoscaler config artifact names.
|
||||
# This helps ensure that any unmocked test doesn't alter non-test artifacts.
|
||||
ray.autoscaler.aws.config.RAY = \
|
||||
ray.autoscaler._private.aws.config.RAY = \
|
||||
"ray-autoscaler-aws-test"
|
||||
ray.autoscaler.aws.config.DEFAULT_RAY_INSTANCE_PROFILE = \
|
||||
ray.autoscaler.aws.config.RAY + "-v1"
|
||||
ray.autoscaler.aws.config.DEFAULT_RAY_IAM_ROLE = \
|
||||
ray.autoscaler.aws.config.RAY + "-v1"
|
||||
ray.autoscaler.aws.config.SECURITY_GROUP_TEMPLATE = \
|
||||
ray.autoscaler.aws.config.RAY + "-{}"
|
||||
ray.autoscaler._private.aws.config.DEFAULT_RAY_INSTANCE_PROFILE = \
|
||||
ray.autoscaler._private.aws.config.RAY + "-v1"
|
||||
ray.autoscaler._private.aws.config.DEFAULT_RAY_IAM_ROLE = \
|
||||
ray.autoscaler._private.aws.config.RAY + "-v1"
|
||||
ray.autoscaler._private.aws.config.SECURITY_GROUP_TEMPLATE = \
|
||||
ray.autoscaler._private.aws.config.RAY + "-{}"
|
||||
|
||||
# Default IAM instance profile to expose to tests.
|
||||
DEFAULT_INSTANCE_PROFILE = {
|
||||
@@ -35,7 +35,7 @@ DEFAULT_INSTANCE_PROFILE = {
|
||||
# Default EC2 key pair to expose to tests.
|
||||
DEFAULT_KEY_PAIR = {
|
||||
"KeyFingerprint": "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00",
|
||||
"KeyName": ray.autoscaler.aws.config.RAY + "_us-west-2",
|
||||
"KeyName": ray.autoscaler._private.aws.config.RAY + "_us-west-2",
|
||||
}
|
||||
|
||||
# Primary EC2 subnet to expose to tests.
|
||||
@@ -69,7 +69,8 @@ DEFAULT_CLUSTER_NAME = "test-cluster-name"
|
||||
# (prior to inbound rule configuration).
|
||||
DEFAULT_SG = {
|
||||
"Description": "Auto-created security group for Ray workers",
|
||||
"GroupName": ray.autoscaler.aws.config.RAY + "-" + DEFAULT_CLUSTER_NAME,
|
||||
"GroupName": ray.autoscaler._private.aws.config.RAY + "-" +
|
||||
DEFAULT_CLUSTER_NAME,
|
||||
"OwnerId": "test-owner",
|
||||
"GroupId": "sg-1234abcd",
|
||||
"VpcId": DEFAULT_SUBNET["VpcId"],
|
||||
|
||||
@@ -2,11 +2,12 @@ import os
|
||||
import yaml
|
||||
import ray
|
||||
|
||||
from ray.autoscaler.commands import prepare_config, validate_config
|
||||
from ray.autoscaler._private.commands import prepare_config, validate_config
|
||||
from ray.tests.aws.utils.constants import DEFAULT_CLUSTER_NAME
|
||||
|
||||
|
||||
def get_aws_example_config_file_path(file_name):
|
||||
import ray.autoscaler.aws
|
||||
return os.path.join(
|
||||
os.path.dirname(ray.autoscaler.aws.__file__), file_name)
|
||||
|
||||
@@ -20,7 +21,7 @@ def bootstrap_aws_config(config):
|
||||
config = prepare_config(config)
|
||||
validate_config(config)
|
||||
config["cluster_name"] = DEFAULT_CLUSTER_NAME
|
||||
return ray.autoscaler.aws.config.bootstrap_aws(config)
|
||||
return ray.autoscaler._private.aws.config.bootstrap_aws(config)
|
||||
|
||||
|
||||
def bootstrap_aws_example_config_file(file_name):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ray.autoscaler.aws.config import key_pair
|
||||
from ray.autoscaler._private.aws.config import key_pair
|
||||
from ray.tests.aws.utils.constants import DEFAULT_KEY_PAIR
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ def configure_iam_role_default(iam_client_stub):
|
||||
iam_client_stub.add_response(
|
||||
"get_instance_profile",
|
||||
expected_params={
|
||||
"InstanceProfileName": ray.autoscaler.aws.config.
|
||||
"InstanceProfileName": ray.autoscaler._private.aws.config.
|
||||
DEFAULT_RAY_INSTANCE_PROFILE
|
||||
},
|
||||
service_response={"InstanceProfile": DEFAULT_INSTANCE_PROFILE})
|
||||
|
||||
Reference in New Issue
Block a user