Skip to content

Commit fc4bff6

Browse files
authored
fix: missing formatting (#29)
1 parent 62c11b5 commit fc4bff6

File tree

6 files changed

+48
-25
lines changed

6 files changed

+48
-25
lines changed

test/e2e/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
bootstrap_directory = Path(__file__).parent
3131
resource_directory = Path(__file__).parent / "resources"
3232

33+
3334
def sagemaker_client():
3435
return boto3.client("sagemaker")
3536

@@ -136,9 +137,7 @@ def wait_resource_endpoint_status(
136137
)
137138

138139

139-
def assert_endpoint_status_in_sync(
140-
endpoint_name, reference, expected_status
141-
):
140+
def assert_endpoint_status_in_sync(endpoint_name, reference, expected_status):
142141
assert (
143142
wait_sagemaker_endpoint_status(endpoint_name, expected_status)
144143
== wait_resource_endpoint_status(reference, expected_status, 2)

test/e2e/common/fixtures.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ def xgboost_churn_endpoint(sagemaker_client):
7474
)
7575
assert endpoint_resource is not None
7676
assert k8s.get_resource_arn(endpoint_resource) is not None
77-
wait_sagemaker_endpoint_status(
78-
replacements["ENDPOINT_NAME"], "InService"
79-
)
77+
wait_sagemaker_endpoint_status(replacements["ENDPOINT_NAME"], "InService")
8078

8179
yield endpoint_spec
8280

test/e2e/service_bootstrap.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,20 @@ def create_data_bucket() -> str:
9393
# duplicate_bucket_contents(source_bucket, destination_bucket)
9494
# workaround to copy if buckets are across regions
9595
# TODO: check if there is a better way and merge to test-infra
96-
subprocess.call(['mkdir',f'{temp_dir}'])
97-
subprocess.call(['aws', 's3', 'sync', f's3://{SAGEMAKER_SOURCE_DATA_BUCKET}', f'./{temp_dir}/', '--quiet'])
98-
subprocess.call(['aws', 's3', 'sync', f'./{temp_dir}/', f's3://{bucket_name}', '--quiet'])
96+
subprocess.call(["mkdir", f"{temp_dir}"])
97+
subprocess.call(
98+
[
99+
"aws",
100+
"s3",
101+
"sync",
102+
f"s3://{SAGEMAKER_SOURCE_DATA_BUCKET}",
103+
f"./{temp_dir}/",
104+
"--quiet",
105+
]
106+
)
107+
subprocess.call(
108+
["aws", "s3", "sync", f"./{temp_dir}/", f"s3://{bucket_name}", "--quiet"]
109+
)
99110

100111
logging.info(f"Synced data bucket")
101112

test/e2e/tests/test_adopt_endpoint.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@
3030
create_adopted_resource,
3131
wait_sagemaker_endpoint_status,
3232
assert_endpoint_status_in_sync,
33-
sagemaker_client
33+
sagemaker_client,
3434
)
3535
from e2e.replacement_values import REPLACEMENT_VALUES
3636
from e2e.common import config as cfg
3737

38+
3839
@pytest.fixture(scope="module")
3940
def name_suffix():
4041
return random_suffix_name("sdk-endpoint", 32)
4142

43+
4244
def sdk_make_model(model_name):
4345
data_bucket = REPLACEMENT_VALUES["SAGEMAKER_DATA_BUCKET"]
4446
model_input = {
@@ -56,6 +58,7 @@ def sdk_make_model(model_name):
5658
assert model_response.get("ModelArn", None) is not None
5759
return model_input, model_response
5860

61+
5962
def sdk_make_endpoint_config(model_name, endpoint_config_name):
6063
endpoint_config_input = {
6164
"EndpointConfigName": endpoint_config_name,
@@ -75,6 +78,7 @@ def sdk_make_endpoint_config(model_name, endpoint_config_name):
7578
assert endpoint_config_response.get("EndpointConfigArn", None) is not None
7679
return endpoint_config_input, endpoint_config_response
7780

81+
7882
def sdk_make_endpoint(endpoint_name, endpoint_config_name):
7983
endpoint_input = {
8084
"EndpointName": endpoint_name,
@@ -85,15 +89,20 @@ def sdk_make_endpoint(endpoint_name, endpoint_config_name):
8589

8690
return endpoint_input, endpoint_response
8791

92+
8893
@pytest.fixture(scope="module")
8994
def sdk_endpoint(name_suffix):
9095
model_name = name_suffix + "-model"
9196
endpoint_config_name = name_suffix + "-config"
9297
endpoint_name = name_suffix
9398

9499
model_input, model_response = sdk_make_model(model_name)
95-
endpoint_config_input, endpoint_config_response = sdk_make_endpoint_config(model_name, endpoint_config_name)
96-
endpoint_input, endpoint_response = sdk_make_endpoint(endpoint_name, endpoint_config_name)
100+
endpoint_config_input, endpoint_config_response = sdk_make_endpoint_config(
101+
model_name, endpoint_config_name
102+
)
103+
endpoint_input, endpoint_response = sdk_make_endpoint(
104+
endpoint_name, endpoint_config_name
105+
)
97106

98107
yield (
99108
model_input,
@@ -103,9 +112,7 @@ def sdk_endpoint(name_suffix):
103112
endpoint_input,
104113
endpoint_response,
105114
)
106-
wait_sagemaker_endpoint_status(
107-
endpoint_name, cfg.ENDPOINT_STATUS_INSERVICE
108-
)
115+
wait_sagemaker_endpoint_status(endpoint_name, cfg.ENDPOINT_STATUS_INSERVICE)
109116
sagemaker_client().delete_endpoint(EndpointName=endpoint_name)
110117
sagemaker_client().delete_endpoint_config(EndpointConfigName=endpoint_config_name)
111118
sagemaker_client().delete_model(ModelName=model_name)
@@ -234,7 +241,11 @@ def test_smoke(self, sdk_endpoint, adopted_endpoint):
234241
)
235242

236243
endpoint_reference = k8s.create_reference(
237-
CRD_GROUP, CRD_VERSION, cfg.ENDPOINT_RESOURCE_PLURAL, endpoint_name, namespace
244+
CRD_GROUP,
245+
CRD_VERSION,
246+
cfg.ENDPOINT_RESOURCE_PLURAL,
247+
endpoint_name,
248+
namespace,
238249
)
239250
endpoint_resource = k8s.wait_resource_consumed_by_controller(endpoint_reference)
240251
assert endpoint_resource is not None

test/e2e/tests/test_endpoint_config.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@
2222
from acktest.resources import random_suffix_name
2323
from acktest.k8s import resource as k8s
2424

25-
from e2e import (
26-
service_marker,
27-
create_sagemaker_resource,
28-
sagemaker_client
29-
)
25+
from e2e import service_marker, create_sagemaker_resource, sagemaker_client
3026
from e2e.replacement_values import REPLACEMENT_VALUES
3127
from e2e.common import config as cfg
3228

@@ -65,6 +61,7 @@ def single_variant_config():
6561
_, deleted = k8s.delete_custom_resource(config_reference, 3, 10)
6662
assert deleted
6763

64+
6865
def get_sagemaker_endpoint_config(config_name: str):
6966
try:
7067
return sagemaker_client().describe_endpoint_config(
@@ -86,11 +83,13 @@ def test_create_endpoint_config(self, single_variant_config):
8683

8784
config_name = resource["spec"].get("endpointConfigName", None)
8885

89-
assert k8s.get_resource_arn(resource) == get_sagemaker_endpoint_config(config_name)["EndpointConfigArn"]
86+
assert (
87+
k8s.get_resource_arn(resource)
88+
== get_sagemaker_endpoint_config(config_name)["EndpointConfigArn"]
89+
)
9090

9191
# Delete the k8s resource.
9292
_, deleted = k8s.delete_custom_resource(reference, 3, 10)
9393
assert deleted
9494

9595
assert get_sagemaker_endpoint_config(config_name) is None
96-

test/e2e/tests/test_model.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def xgboost_model():
5151
_, deleted = k8s.delete_custom_resource(reference, 3, 10)
5252
assert deleted
5353

54+
5455
def get_sagemaker_model(model_name: str):
5556
try:
5657
return sagemaker_client().describe_model(ModelName=model_name)
@@ -59,6 +60,8 @@ def get_sagemaker_model(model_name: str):
5960
f"SageMaker could not find a model with the name {model_name}. Error {error}"
6061
)
6162
return None
63+
64+
6265
@service_marker
6366
@pytest.mark.canary
6467
class TestModel:
@@ -68,11 +71,13 @@ def test_create_model(self, xgboost_model):
6871

6972
model_name = resource["spec"].get("modelName", None)
7073

71-
assert k8s.get_resource_arn(resource) == get_sagemaker_model(model_name)["ModelArn"]
74+
assert (
75+
k8s.get_resource_arn(resource)
76+
== get_sagemaker_model(model_name)["ModelArn"]
77+
)
7278

7379
# Delete the k8s resource.
7480
_, deleted = k8s.delete_custom_resource(reference, 3, 10)
7581
assert deleted
7682

7783
assert get_sagemaker_model(model_name) is None
78-

0 commit comments

Comments
 (0)