-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support Models in dbutils.fs
operations
#750
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these basically duplicate _VolumesPath and _VolumesIO. Let's reuse those instead of defining duplicate implementations. We can rename those to _FilesPath
and _FilesIO
to indicate that they can be used generally for resources backed by the Files API.
databricks/sdk/mixins/files.py
Outdated
@@ -467,6 +565,75 @@ def __repr__(self) -> str: | |||
return f'<_VolumesPath {self._path}>' | |||
|
|||
|
|||
class _ModelsPath(_Path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a new Path implementation? It seems like this just uses the Files API under the hood. From what I can tell, the only difference is open()
, which returns ModelsIO now. That is in turn almost identical to _FilesIO.
If we changed https://github.com/databricks/databricks-sdk-py/pull/750/files#diff-469b96ba8e49ef7cbe8d3b4577d2a0ddf3a3552638b76d87bfccb936fda65d18R759 to check whether the path started with either /Volumes
or /Models
, I think the existing implementation would work. Is this correct? If so, we should just rename that to _FilesPath
(as it uses the Files API) and reuse it.
Ultimately, that _path
method should probably use some kind of prefix allowlist to determine whether the _FilesPath
should be used, and we can add /Volumes
and /Models
as the initial prefixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mgyucht that sounds better. thanks for the suggestion, updated.
(I am not in the osp team but offered to do this work so we can speed up mlflow adoption of the databricks sdk, but I think since it's all Files API / Presigned URLs behind this sdk, we should be able to reuse the same path and io class for all securables)
dbutils.fs
operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for this contribution!
jenkins merge |
hey @mgyucht how you know how to merge this pr? not seeing anything on my UI for merging |
Head branch was pushed to by a user without write access
a26ecae
to
c7367a5
Compare
c7367a5
to
e991dd0
Compare
### New Features and Improvements * Support Models in `dbutils.fs` operations ([#750](#750)). ### Bug Fixes * Do not specify --tenant flag when fetching managed identity access token from the CLI ([#748](#748)). * Fix deserialization of 401/403 errors ([#758](#758)). * Use correct optional typing in `WorkspaceClient` for `mypy` ([#760](#760)).
### New Features and Improvements * Support Models in `dbutils.fs` operations ([#750](#750)). ### Bug Fixes * Do not specify --tenant flag when fetching managed identity access token from the CLI ([#748](#748)). * Fix deserialization of 401/403 errors ([#758](#758)). * Use correct optional typing in `WorkspaceClient` for `mypy` ([#760](#760)).
### New Features and Improvements * Support Models in `dbutils.fs` operations ([databricks#750](databricks#750)). ### Bug Fixes * Do not specify --tenant flag when fetching managed identity access token from the CLI ([databricks#748](databricks#748)). * Fix deserialization of 401/403 errors ([databricks#758](databricks#758)). * Use correct optional typing in `WorkspaceClient` for `mypy` ([databricks#760](databricks#760)).
) This reverts commit 3162545. Verified that /Models download still work correctly. ## Changes <!-- Summary of your changes that are easy to understand --> ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [ ] `make test` run locally - [ ] `make fmt` applied - [ ] relevant integration tests applied
### Bug Fixes * Fix Model Serving Test ([#781](#781)). * Include package name for external types when deserializing responses ([#786](#786)). ### Internal Changes * Refactor ApiClient into `_BaseClient` and `ApiClient` ([#785](#785)). * Update to latest OpenAPI spec ([#787](#787)). * revert Support Models in `dbutils.fs` operations ([#750](#750)) ([#778](#778)). ### API Changes: * Added [w.disable_legacy_dbfs](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/settings/disable_legacy_dbfs.html) workspace-level service. * Added `default_source_code_path` and `resources` fields for `databricks.sdk.service.apps.App`. * Added `resources` field for `databricks.sdk.service.apps.CreateAppRequest`. * Added `resources` field for `databricks.sdk.service.apps.UpdateAppRequest`. OpenAPI SHA: bc17b474818138f19b78a7bea0675707dead2b87, Date: 2024-10-07
### Bug Fixes * Fix Model Serving Test ([#781](#781)). * Include package name for external types when deserializing responses ([#786](#786)). ### Internal Changes * Refactor ApiClient into `_BaseClient` and `ApiClient` ([#785](#785)). * Update to latest OpenAPI spec ([#787](#787)). * revert Support Models in `dbutils.fs` operations ([#750](#750)) ([#778](#778)). ### API Changes: * Added [w.disable_legacy_dbfs](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/settings/disable_legacy_dbfs.html) workspace-level service. * Added `default_source_code_path` and `resources` fields for `databricks.sdk.service.apps.App`. * Added `resources` field for `databricks.sdk.service.apps.CreateAppRequest`. * Added `resources` field for `databricks.sdk.service.apps.UpdateAppRequest`. OpenAPI SHA: bc17b474818138f19b78a7bea0675707dead2b87, Date: 2024-10-07
Changes
Tests
make test
run locallymake fmt
applied