Skip to content

Commit c77a842

Browse files
committed
fix codestyle
1 parent 4495904 commit c77a842

File tree

4 files changed

+30
-34
lines changed

4 files changed

+30
-34
lines changed

tests/integ/sagemaker/experiments/test_run.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from sagemaker.experiments.trial_component import _TrialComponent
3333
from sagemaker.sklearn import SKLearn
3434
from sagemaker.utils import retry_with_backoff, unique_name_from_base
35-
from tests.integ.sagemaker.experiments.helpers import name, cleanup_exp_resources, clear_run_context
35+
from tests.integ.sagemaker.experiments.helpers import name, cleanup_exp_resources
3636
from sagemaker.experiments.run import (
3737
RUN_NAME_BASE,
3838
DELIMITER,
@@ -55,7 +55,7 @@ def artifact_file_path(tempdir):
5555
metric_name = "Test-Local-Init-Log-Metric"
5656

5757

58-
def test_local_run_with_load(sagemaker_session, artifact_file_path, clear_run_context):
58+
def test_local_run_with_load(sagemaker_session, artifact_file_path):
5959
exp_name = f"My-Local-Exp-{name()}"
6060
with cleanup_exp_resources(exp_names=[exp_name], sagemaker_session=sagemaker_session):
6161
# Run name is not provided, will create a new TC
@@ -87,7 +87,7 @@ def verify_load_run():
8787

8888

8989
def test_two_local_run_init_with_same_run_name_and_different_exp_names(
90-
sagemaker_session, clear_run_context
90+
sagemaker_session
9191
):
9292
exp_name1 = f"my-two-local-exp1-{name()}"
9393
exp_name2 = f"my-two-local-exp2-{name()}"
@@ -127,7 +127,7 @@ def test_two_local_run_init_with_same_run_name_and_different_exp_names(
127127
],
128128
)
129129
def test_run_name_vs_trial_component_name_edge_cases(
130-
sagemaker_session, input_names, clear_run_context
130+
sagemaker_session, input_names
131131
):
132132
exp_name, run_name, run_display_name = input_names
133133
with cleanup_exp_resources(exp_names=[exp_name], sagemaker_session=sagemaker_session):
@@ -181,7 +181,6 @@ def test_run_from_local_and_train_job_and_all_exp_cfg_match(
181181
execution_role,
182182
sagemaker_client_config,
183183
sagemaker_metrics_config,
184-
clear_run_context,
185184
):
186185
# Notes:
187186
# 1. The 1st Run created locally and its exp config was auto passed to the job
@@ -282,7 +281,6 @@ def test_run_from_local_and_train_job_and_exp_cfg_not_match(
282281
execution_role,
283282
sagemaker_client_config,
284283
sagemaker_metrics_config,
285-
clear_run_context,
286284
):
287285
# Notes:
288286
# 1. The 1st Run created locally and its exp config was auto passed to the job
@@ -369,7 +367,6 @@ def test_run_from_train_job_only(
369367
execution_role,
370368
sagemaker_client_config,
371369
sagemaker_metrics_config,
372-
clear_run_context,
373370
):
374371
# Notes:
375372
# 1. No Run created locally or specified in experiment config
@@ -420,7 +417,6 @@ def test_run_from_processing_job_and_override_default_exp_config(
420417
execution_role,
421418
sagemaker_client_config,
422419
sagemaker_metrics_config,
423-
clear_run_context,
424420
):
425421
# Notes:
426422
# 1. The 1st Run (run) created locally
@@ -500,7 +496,6 @@ def test_run_from_transform_job(
500496
execution_role,
501497
sagemaker_client_config,
502498
sagemaker_metrics_config,
503-
clear_run_context,
504499
):
505500
# Notes:
506501
# 1. The 1st Run (run) created locally
@@ -582,7 +577,6 @@ def test_load_run_auto_pass_in_exp_config_to_job(
582577
execution_role,
583578
sagemaker_client_config,
584579
sagemaker_metrics_config,
585-
clear_run_context,
586580
):
587581
# Notes:
588582
# 1. In local side, load the Run created previously and invoke a job under the load context
@@ -631,7 +625,7 @@ def test_load_run_auto_pass_in_exp_config_to_job(
631625
)
632626

633627

634-
def test_list(run_obj, sagemaker_session, clear_run_context):
628+
def test_list(run_obj, sagemaker_session):
635629
tc1 = _TrialComponent.create(
636630
trial_component_name=f"non-run-tc1-{name()}",
637631
sagemaker_session=sagemaker_session,
@@ -653,7 +647,7 @@ def test_list(run_obj, sagemaker_session, clear_run_context):
653647
assert run_tcs[0].experiment_config == run_obj.experiment_config
654648

655649

656-
def test_list_twice(run_obj, sagemaker_session, clear_run_context):
650+
def test_list_twice(run_obj, sagemaker_session):
657651
tc1 = _TrialComponent.create(
658652
trial_component_name=f"non-run-tc1-{name()}",
659653
sagemaker_session=sagemaker_session,

tests/integ/test_feature_store.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,9 +1645,11 @@ def test_create_dataset_with_feature_group_base(
16451645
feature_store_session, feature_group, offline_store_s3_uri
16461646
)
16471647

1648-
with timeout(minutes=10) and cleanup_offline_store(
1649-
base, feature_store_session
1650-
) and cleanup_offline_store(feature_group, feature_store_session):
1648+
with (
1649+
timeout(minutes=10)
1650+
and cleanup_offline_store(base, feature_store_session)
1651+
and cleanup_offline_store(feature_group, feature_store_session)
1652+
):
16511653
feature_store = FeatureStore(sagemaker_session=feature_store_session)
16521654
df, query_string = (
16531655
feature_store.create_dataset(base=base, output_path=offline_store_s3_uri)
@@ -1832,9 +1834,11 @@ def test_create_dataset_with_feature_group_base_with_additional_params(
18321834
feature_store_session, feature_group, offline_store_s3_uri
18331835
)
18341836

1835-
with timeout(minutes=10) and cleanup_offline_store(
1836-
base, feature_store_session
1837-
) and cleanup_offline_store(feature_group, feature_store_session):
1837+
with (
1838+
timeout(minutes=10)
1839+
and cleanup_offline_store(base, feature_store_session)
1840+
and cleanup_offline_store(feature_group, feature_store_session)
1841+
):
18381842
feature_store = FeatureStore(sagemaker_session=feature_store_session)
18391843
df, query_string = (
18401844
feature_store.create_dataset(base=base, output_path=offline_store_s3_uri)

tests/unit/sagemaker/modules/train/test_model_trainer.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,17 +1050,17 @@ def mock_upload_data(path, bucket, key_prefix):
10501050
model_trainer.train()
10511051

10521052
mock_local_container.assert_called_once_with(
1053-
training_job_name=unique_name,
1054-
instance_type=compute.instance_type,
1055-
instance_count=compute.instance_count,
1056-
image=training_image,
1057-
container_root=local_container_root,
1058-
sagemaker_session=modules_session,
1059-
container_entrypoint=DEFAULT_ENTRYPOINT,
1060-
container_arguments=DEFAULT_ARGUMENTS,
1061-
input_data_config=ANY,
1062-
hyper_parameters=hyperparameters,
1063-
environment=environment,
1053+
training_job_name=unique_name,
1054+
instance_type=compute.instance_type,
1055+
instance_count=compute.instance_count,
1056+
image=training_image,
1057+
container_root=local_container_root,
1058+
sagemaker_session=modules_session,
1059+
container_entrypoint=DEFAULT_ENTRYPOINT,
1060+
container_arguments=DEFAULT_ARGUMENTS,
1061+
input_data_config=ANY,
1062+
hyper_parameters=hyperparameters,
1063+
environment=environment,
10641064
)
10651065

10661066

tests/unit/sagemaker/workflow/test_pipeline.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import pytest
2020

2121
from mock import Mock, call, patch
22-
from mock.mock import MagicMock, ANY
22+
from mock.mock import MagicMock
2323

2424
from sagemaker import s3
2525
from sagemaker.remote_function.job import _JobSettings
@@ -345,7 +345,7 @@ def test_pipeline_update_with_parallelism_config(sagemaker_session_mock, role_ar
345345
role_arn=role_arn,
346346
parallelism_config=dict(MaxParallelExecutionSteps=10),
347347
)
348-
pipeline.update(
348+
pipeline.update(
349349
role_arn=role_arn,
350350
parallelism_config={"MaxParallelExecutionSteps": 10},
351351
)
@@ -422,9 +422,7 @@ def _raise_does_already_exists_client_error(**kwargs):
422422
sagemaker_session_mock.sagemaker_client.update_pipeline.assert_called_once_with(
423423
PipelineName="MyPipeline", PipelineDefinition=pipeline.definition(), RoleArn=role_arn
424424
)
425-
sagemaker_session_mock.sagemaker_client.list_tags.assert_called_with(
426-
ResourceArn="pipeline-arn"
427-
)
425+
sagemaker_session_mock.sagemaker_client.list_tags.assert_called_with(ResourceArn="pipeline-arn")
428426

429427
tags.append({"Key": "dummy", "Value": "dummy_tag"})
430428
sagemaker_session_mock.sagemaker_client.add_tags.assert_called_with(

0 commit comments

Comments
 (0)