Skip to content

Commit 7d39f33

Browse files
authored
Fixes the progress bar issue when exporting artifacts to the Model Catalog (#331)
2 parents 8072892 + e22c58e commit 7d39f33

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

ads/model/service/oci_datascience_model.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@
3838
)
3939

4040

41-
class ModelProvenanceNotFoundError(Exception): # pragma: no cover
41+
class ModelProvenanceNotFoundError(Exception): # pragma: no cover
4242
pass
4343

4444

45-
class ModelArtifactNotFoundError(Exception): # pragma: no cover
45+
class ModelArtifactNotFoundError(Exception): # pragma: no cover
4646
pass
4747

4848

49-
class ModelNotSavedError(Exception): # pragma: no cover
49+
class ModelNotSavedError(Exception): # pragma: no cover
5050
pass
5151

5252

53-
class ModelWithActiveDeploymentError(Exception): # pragma: no cover
53+
class ModelWithActiveDeploymentError(Exception): # pragma: no cover
5454
pass
5555

5656

@@ -410,7 +410,7 @@ def export_model_artifact(self, bucket_uri: str, region: str = None):
410410
# Show progress of exporting model artifacts
411411
self._wait_for_work_request(
412412
work_request_id=work_request_id,
413-
num_steps=3,
413+
num_steps=2,
414414
)
415415

416416
@check_for_model_id(
@@ -596,3 +596,7 @@ def _wait_for_work_request(self, work_request_id: str, num_steps: int = 3) -> No
596596
)
597597
else:
598598
break
599+
600+
while i < num_steps:
601+
progress.update()
602+
i += 1

docs/source/user_guide/model_catalog/model_catalog.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ If you don't have an Object Storage bucket, create one using the OCI SDK or the
12041204
12051205
Allow service datascience to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
12061206
1207-
Allow service objectstorage to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
1207+
Allow service objectstorage-<region> to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
12081208
12091209
Saving
12101210
======
@@ -1545,4 +1545,3 @@ In the next example, the model that was stored in the model catalog as part of t
15451545
.. code-block:: python3
15461546
15471547
mc.delete_model(mc_model.id)
1548-

docs/source/user_guide/model_registration/large_model_artifact.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If you don't have an Object Storage bucket, create one using the OCI SDK or the
1313
1414
Allow service datascience to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
1515
16-
Allow service objectstorage to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
16+
Allow service objectstorage-<region> to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
1717
1818
See `API documentation <../../ads.model.html#id10>`__ for more details.
1919

docs/source/user_guide/model_registration/model_load.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ If you don't have an Object Storage bucket, create one using the OCI SDK or the
119119
120120
Allow service datascience to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
121121
122-
Allow service objectstorage to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
122+
Allow service objectstorage-<region> to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
123123
124124
The following example loads a model using the large model artifact approach. The ``bucket_uri`` has the following syntax: ``oci://<bucket_name>@<namespace>/<path>/`` See `API documentation <../../ads.model.html#id4>`__ for more details.
125125

@@ -169,4 +169,4 @@ Alternatively the ``.from_id()`` method can be used to load registered or deploy
169169
bucket_uri=<oci://<bucket_name>@<namespace>/prefix/>,
170170
force_overwrite=True,
171171
remove_existing_artifact=True,
172-
)
172+
)

tests/unitary/default_setup/model/test_oci_datascience_model.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888

8989
class TestOCIDataScienceModel:
9090
def setup_class(cls):
91-
9291
# Mock delete model response
9392
cls.mock_delete_model_response = Response(
9493
data=None, status=None, headers=None, request=None
@@ -229,7 +228,9 @@ def test_delete_success(self, mock_client):
229228
mock_model_deployment.return_value = [
230229
MagicMock(lifecycle_state="ACTIVE", identifier="md_id")
231230
]
232-
with patch("ads.model.deployment.ModelDeployment.from_id") as mock_from_id:
231+
with patch(
232+
"ads.model.deployment.ModelDeployment.from_id"
233+
) as mock_from_id:
233234
with patch.object(OCIDataScienceModel, "sync") as mock_sync:
234235
self.mock_model.delete(delete_associated_model_deployment=True)
235236
mock_from_id.assert_called_with("md_id")
@@ -445,7 +446,7 @@ def test_export_model_artifact(
445446
)
446447
mock_wait_for_work_request.assert_called_with(
447448
work_request_id="work_request_id",
448-
num_steps=3,
449+
num_steps=2,
449450
)
450451

451452
@patch.object(TqdmProgressBar, "update")

0 commit comments

Comments
 (0)