Skip to content

Commit ab03ba2

Browse files
committed
MultiPartCopy with Sync Algorithm (aws#4475)
* first pass at sync function with util classes * adding tests and update clases * linting * file generator class inheritance * lint * multipart copy and algorithm updates * modularize sync * reformatting folders * testing for sync * do not tolerate vulnerable * remove prints * handle multithreading progress bar * update tests * optimize function and add hub bucket prefix * docstrings and linting
1 parent 6d6c170 commit ab03ba2

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/sagemaker/jumpstart/cache.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,9 @@ def _retrieval_function(
472472
formatted_content=DescribeHubResponse(hub_description)
473473
)
474474

475-
raise ValueError(self._file_type_error_msg(data_type))
475+
raise ValueError(
476+
self._file_type_error_msg(data_type)
477+
)
476478

477479
def get_manifest(
478480
self,

tests/unit/sagemaker/jumpstart/curated_hub/test_utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,7 @@ def test_generate_hub_arn_for_init_kwargs():
148148
utils.generate_hub_arn_for_init_kwargs(hub_arn, "us-east-1", mock_custom_session) == hub_arn
149149
)
150150

151-
assert (
152-
utils.generate_hub_arn_for_estimator_init_kwargs(hub_arn, None, mock_custom_session)
153-
== hub_arn
154-
)
151+
assert utils.generate_hub_arn_for_init_kwargs(hub_arn, None, mock_custom_session) == hub_arn
155152

156153

157154
def test_generate_default_hub_bucket_name():
@@ -171,8 +168,14 @@ def test_create_hub_bucket_if_it_does_not_exist():
171168
mock_sagemaker_session.client("sts").get_caller_identity.return_value = {
172169
"Account": "123456789123"
173170
}
171+
hub_arn = "arn:aws:sagemaker:us-west-2:12346789123:hub/my-awesome-hub"
172+
# Mock custom session with custom values
173+
mock_custom_session = Mock()
174+
mock_custom_session.account_id.return_value = "000000000000"
175+
mock_custom_session.boto_region_name = "us-east-2"
174176
mock_sagemaker_session.boto_session.resource("s3").Bucket().creation_date = None
175177
mock_sagemaker_session.boto_region_name = "us-east-1"
178+
176179
bucket_name = "sagemaker-hubs-us-east-1-123456789123"
177180
created_hub_bucket_name = utils.create_hub_bucket_if_it_does_not_exist(
178181
sagemaker_session=mock_sagemaker_session

tests/unit/sagemaker/jumpstart/test_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ def test_jumpstart_local_metadata_override_specs_not_exist_both_directories(
11341134

11351135
mocked_is_dir.assert_any_call("/some/directory/metadata/manifest/root")
11361136
assert mocked_is_dir.call_count == 2
1137-
assert mocked_open.call_count == 2
1137+
mocked_open.assert_not_called()
11381138
mocked_get_json_file_and_etag_from_s3.assert_has_calls(
11391139
calls=[
11401140
call("models_manifest.json"),

0 commit comments

Comments
 (0)