-
Notifications
You must be signed in to change notification settings - Fork 568
Reset active project after deleting local database #3689
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
Reset active project after deleting local database #3689
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 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
|
stefannica
left a comment
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 looks harmless, but my spider senses tell me it is dangerous because it disturbs the very delicate choreography of instantiation for Client, GlobalConfig and *ZenStore.
Whatever the error is, is it not fixable from the logic that validates the configuration (see _sanitize_config) ?
|
@stefannica I couldn't find a different solution, but you're welcome to try 😄 I think this is harmless though, if you look at the code:
I could of course change it to if self._active_project is not None:
return self._active_project
_ = self.zen_store # This would happen in the next line anyway
project = self.zen_store.get_project(
project_name_or_id=self.get_active_project_id(),
)
return self.set_active_project(project)if this feels safer to you. The only thing that would do though IMO would be an extra call of |
|
@stefannica You can use this to reproduce: from zenml import pipeline, step
from zenml.materializers.built_in_materializer import BuiltInMaterializer
class CustomMaterializer(BuiltInMaterializer):
ASSOCIATED_TYPES = (int,)
@step(output_materializers=CustomMaterializer)
def my_step() -> int:
return 1
@pipeline(enable_cache=True)
def my_pipeline():
my_step()
if __name__ == "__main__":
my_pipeline() |

Describe changes
This fixes the following case:
The ID of the previously active project will still be stored in the global config, but won't exist anymore in the newly created database. This lead to an error that the project can not be found.
Pre-requisites
Please ensure you have done the following:
developand the open PR is targetingdevelop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes