Skip to content

Commit

Permalink
raise warning instead of error to allow assessment in regions that do…
Browse files Browse the repository at this point in the history
… not support certain features (#2128)

## Changes
raise warning instead of error to allow assessment in regions that do
not support certain features

### Linked issues
Resolves #2082 

### Functionality
None

### Tests
- [x] added unit tests

Co-authored-by: Eric Vergnaud <[email protected]>
  • Loading branch information
ericvergnaud and ericvergnaud authored Jul 10, 2024
1 parent f987244 commit 4a75a7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/databricks/labs/ucx/workspace_access/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __iter__(self):
for item in self._func():
yield GenericPermissionsInfo(getattr(item, self._id_attribute), self._object_type)
except NotFound as e:
logger.error(f"Listing {self._object_type} failed: {e}")
logger.warning(f"Listing {self._object_type} failed: {e}")
since = datetime.datetime.now() - started
logger.info(f"Listed {self._object_type} in {since}")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/workspace_access/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,11 @@ def test_models_page_listing():
assert item.object_type == "registered-models"


def test_serving_endpoints_not_enabled(caplog):
def test_serving_endpoints_not_enabled_raises_warning(caplog):
ws = create_autospec(WorkspaceClient)
ws.serving_endpoints.list.side_effect = NotFound("Model serving is not enabled for your shard")

sup = GenericPermissionsSupport(ws=ws, listings=[Listing(ws.serving_endpoints.list, "id", "serving-endpoints")])
with caplog.at_level('ERROR'):
with caplog.at_level('WARNING'):
list(sup.get_crawler_tasks())
assert "Listing serving-endpoints failed: Model serving is not enabled for your shard" in caplog.text

0 comments on commit 4a75a7b

Please sign in to comment.