-
Notifications
You must be signed in to change notification settings - Fork 442
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
ZenML Pro web login implementation #3141
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
|
dd4dff9
to
8473eeb
Compare
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 was a pleasure to read, so much better than before!
@stefannica I just tried this, and after trusting my device for 30 days, I get the following output in the CLI 2024-11-23 ┃
┃ │ │ 385a9795 │ │ │ │ │ io/organizations/00c4d26e-d2 │ ng.cloudinfra.zenml.io │ 00:18:16 CET (in ┃
┃ │ │ │ │ │ │ │ 65-4f65-80c5-767737e6b8b7/te │ │ 28d11h59m0s) Seems like there is one day missing somehow? |
Co-authored-by: Michael Schuster <[email protected]>
…nml into feature/GROW-105-zenml-login
This is a best practice I implemented regarding API tokens: you extract a leeway (percentage off token validity) from the original validity period in order to trigger or ask for a re-login before the tokens actually expire. 1 day out of 30 might be a bit to much though, but we can find a proper solution for this if you think it's not right. The current algorithm is implemented in the credentials store:
|
No all good, just wanted to mention that this seemed a little odd. Wouldn't it make sense to ask for a re-login with the leeway included, but display the actual expiration date in the CLI? In any case, none of that matters all too much, I'll leave it to you as the expert :) |
@stefannica I have another question where I don't really understand what happens: When running a pipeline remotely, we set the API token in |
Before I answer this, there's another change that is related to this that you should be aware of: the REST Zen Store configuration no longer stores an API key or an API token. It is still allowed to configure the When a pipeline is run remotely, |
Yeah I think when I was trying this, the latest commit which fixes this was not available yet. Now I see the API token being picked up correctly with |
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.
Only two small questions left 🎉
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Classification template updates in |
E2E template updates in |
…nml into feature/GROW-105-zenml-login
NLP template updates in |
…nml into feature/GROW-105-zenml-login
Describe changes
Implements the
zenml login
CLI command and all associated ZenML Pro web login features:The new
zenml login
CLI command can be used to manage the servers that your ZenML client is authenticated and connected to. Note that "connecting" and "authenticating" are no longer equivalent: you only need to authenticate (login) to a ZenML Server once, then connect/re-connect to it as many times as necessary while the authentication is valid, because all temporary credentials are now cached locally in the Credentials Store. This allows users to easily switch between the local server and the remote servers without having to go through the web login authentication flow.zenml login
can be used to:zenml connect
)zenml up
/zenml down
)zenml connect
always refreshed the session)zenml logout
does the reverse and can be used to:zenml disconnect
)zenml down
)zenml server list
can be used to list all the servers that the client can be connected to, with options to include ZenML Pro servers that are inactive or not accessible and ZenML servers that have expired credentials.The existing commands
zenml connect
,zenml up
,zenml down
,zenml disconnect
andzenml show
are kept in place but are deprecated and callzenml login
,zenml logout
andzenml server show
under the hood.Implementation details
At the core of the new features lies a new design component called the Credentials Store. This is a singleton object that maintains a cache of all API tokens and API keys that are configured for the ZenML servers that the client connects to. The cache is persistent and It is backed by a
credentials.yaml
YAML file kept in the global configuration location. The Credentials Store cache is populated in the following ways:zenml login
to authenticate to a ZenML Pro server, it stores the ZenML Pro API token fetched from the web login flow in the Credentials Storezenml login
to authenticate to a regular ZenML server with the web login flow, it stores the ZenML API token fetched through the web login flow in the Credentials Storezenml login
to authenticate to any ZenML server using an API key, it stores the API key in the Credentials StoreAlongside credentials, the Credentials Store is also used to store additional server information:
* ZenML Pro tenant information populated by the
zenml login
command* ZenML server information populated by the REST zen store by fetching the server's information endpoint after authenticating
This information is used in commands like
zenml status
andzenml server list
to display as much information as possible about cached servers.How to test this
Examples
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