-
Notifications
You must be signed in to change notification settings - Fork 478
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
Refactor workspaces into projects #3364
base: develop
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
cc149c0
to
b31ab41
Compare
src/zenml/zen_server/rbac/utils.py
Outdated
Whether the resource type is workspace scoped. | ||
""" | ||
return resource_type in [ | ||
ResourceType.STACK, |
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.
This seems wrong still?
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.
Good eye! However, this was just a left-over function that was completely unused. I already moved everything to the ResourceType enum class.
It's gone now.
b31ab41
to
f820ab2
Compare
…ice-connector/secret
* includes handling default stack / components * includes removing the client code that sets the user field in requests to the active user
…ce scoping Also removed all *ExistsError exceptions, since they were completely unused, and replaced the all with EntityExistsError
…ore and endpoints
9404ab4
to
669359a
Compare
Describe changes
This mega-PR lands the preparation work for the ZenML Projects and clears out a huge chunk of technical debt in the process.
Introduce Global Resources
The following domain entities are refactored to live outside the workspace scope: stacks, stack components, flavors, service connectors and secrets:
[x] the database schema: removed the workspace reference from global resource types.
[x] the database migration: removed the workspace field from global resource types. This is conditioned by there being only one workspace, to avoid name clashes.
[x] the domain models: switched from workspace-scoped to user-scoped request/update/read/filter models for global resource types.
Refactor Workspace-Scoped Endpoints
This PR disbands the create/list workspace-scoped endpoints in the
zenml.zen_server.routers.workspaces_endpoints
module and distributes its endpoints to the other router modules that handle the corresponding resource types. The workspace scoped routers are still kept around for dashboard backwards compatibility, but are merely slapped on top of the regular endpoint implementations that use the standard pattern of setting theworkspace
field in the request models instead of URL path parameters, e.g.:List endpoints and other get/update/delete endpoints that use "name or ID" fields as input arguments and work with workspace-scoped resources have also been heavily refactored to enforce setting the workspace scope in the
WorkspaceScopedFilter
model. The following process is implemented to force the Python client to pass the workspace field in all these requests while at the same time keeping backwards-compatibility with the current dashboard:WorkspaceScopedFilter
model has theworkspace
field set to a workspace UUID, use that as the workspace scopeWorkspaceScopedFilter
model has theworkspace
field set to a workspace name, resolve that to a workspace object and use its ID as the workspace scopeWorkspaceScopedFilter
model does not have theworkspace
field set at all, normally, we would raise an error. However, to maintain backwards-compatibility with the current dashboard, the "Default Workspace" mechanism described in the next session is implemented and used as a fallback.Default Workspace Provisional Mechanism
This is a newly implemented mechanism that comes in addition to the well known
default
workspace. It is applied whenever the client calling a REST endpoint or SQL Zen store request failed to supply the mandatory workspace scope for the workspace-scoped resource(s) to which the call refers. It goes as follows:default
workspace is used as a last resortThis mechanism is provisional and will be removed once the dashboard has been updated to include the workspace scope explicitly in all requests made to the API. The
default
workspace is also going to become a legacy concept, and no longer automatically created for new Pro ZenML servers.Server-Side User Scoping
User-scoping for create requests used to be the responsibility of the client, while the server only verified that the user is set properly to match the active (authorized) users. This PR makes a fundamental change to this responsibility model:
user
field in the create requests (it's optional and no longer listed as a OpenAPI model field).user
field in and of the "create" requests.RBAC Improvements
The RBAC utilities used in API endpoints were improved with the following:
Refactor Secret Scopes to Private Secrets
The
workspace
/user
scoping feature associated with secrets has been refactored into a "Private Secrets" feature. This was necessary given that secrets are no longer workspace-scoped entities.Secrets can be "private" or "public". Private secrets are only visible by their owner.
Technical Debt / Bugs Removal and Quality of Life Improvements
user_id
field from the user scoped base filter model (merged intouser
)workspace_id
field from the workspace scoped base filter model (merged into `workspace)TaggableFilter
were previously broken because they didn't handle the double-inheritance at all when calling super(). This is fixed now.Breaking Changes
StackComponentExistsError
,StackExistsError
andSecretExistsError
have been removed. You should use the commonEntityExistsError
exception class instead.get_run
REST API call has been merged into the existingget_or_create_run
API call.Pre-requisites
Please ensure you have done the following:
develop
and the open PR is targetingdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes