Skip to content

Commit

Permalink
Fixes the progress bar issue when exporting artifacts to the Model Ca…
Browse files Browse the repository at this point in the history
…talog (#331)
  • Loading branch information
mrDzurb authored Sep 13, 2023
2 parents 8072892 + e22c58e commit 7d39f33
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
14 changes: 9 additions & 5 deletions ads/model/service/oci_datascience_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@
)


class ModelProvenanceNotFoundError(Exception): # pragma: no cover
class ModelProvenanceNotFoundError(Exception): # pragma: no cover
pass


class ModelArtifactNotFoundError(Exception): # pragma: no cover
class ModelArtifactNotFoundError(Exception): # pragma: no cover
pass


class ModelNotSavedError(Exception): # pragma: no cover
class ModelNotSavedError(Exception): # pragma: no cover
pass


class ModelWithActiveDeploymentError(Exception): # pragma: no cover
class ModelWithActiveDeploymentError(Exception): # pragma: no cover
pass


Expand Down Expand Up @@ -410,7 +410,7 @@ def export_model_artifact(self, bucket_uri: str, region: str = None):
# Show progress of exporting model artifacts
self._wait_for_work_request(
work_request_id=work_request_id,
num_steps=3,
num_steps=2,
)

@check_for_model_id(
Expand Down Expand Up @@ -596,3 +596,7 @@ def _wait_for_work_request(self, work_request_id: str, num_steps: int = 3) -> No
)
else:
break

while i < num_steps:
progress.update()
i += 1
3 changes: 1 addition & 2 deletions docs/source/user_guide/model_catalog/model_catalog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ If you don't have an Object Storage bucket, create one using the OCI SDK or the
Allow service datascience to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Allow service objectstorage to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Allow service objectstorage-<region> to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Saving
======
Expand Down Expand Up @@ -1545,4 +1545,3 @@ In the next example, the model that was stored in the model catalog as part of t
.. code-block:: python3
mc.delete_model(mc_model.id)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you don't have an Object Storage bucket, create one using the OCI SDK or the
Allow service datascience to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Allow service objectstorage to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Allow service objectstorage-<region> to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
See `API documentation <../../ads.model.html#id10>`__ for more details.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/user_guide/model_registration/model_load.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ If you don't have an Object Storage bucket, create one using the OCI SDK or the
Allow service datascience to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Allow service objectstorage to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
Allow service objectstorage-<region> to manage object-family in compartment <compartment> where ALL {target.bucket.name='<bucket_name>'}
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.

Expand Down Expand Up @@ -169,4 +169,4 @@ Alternatively the ``.from_id()`` method can be used to load registered or deploy
bucket_uri=<oci://<bucket_name>@<namespace>/prefix/>,
force_overwrite=True,
remove_existing_artifact=True,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@

class TestOCIDataScienceModel:
def setup_class(cls):

# Mock delete model response
cls.mock_delete_model_response = Response(
data=None, status=None, headers=None, request=None
Expand Down Expand Up @@ -229,7 +228,9 @@ def test_delete_success(self, mock_client):
mock_model_deployment.return_value = [
MagicMock(lifecycle_state="ACTIVE", identifier="md_id")
]
with patch("ads.model.deployment.ModelDeployment.from_id") as mock_from_id:
with patch(
"ads.model.deployment.ModelDeployment.from_id"
) as mock_from_id:
with patch.object(OCIDataScienceModel, "sync") as mock_sync:
self.mock_model.delete(delete_associated_model_deployment=True)
mock_from_id.assert_called_with("md_id")
Expand Down Expand Up @@ -445,7 +446,7 @@ def test_export_model_artifact(
)
mock_wait_for_work_request.assert_called_with(
work_request_id="work_request_id",
num_steps=3,
num_steps=2,
)

@patch.object(TqdmProgressBar, "update")
Expand Down

0 comments on commit 7d39f33

Please sign in to comment.