Skip to content
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

Don't initialize client during flavor sync #3168

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/zenml/stack/flavor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from abc import abstractmethod
from typing import Any, Dict, Optional, Type, cast

from zenml.client import Client
from zenml.enums import StackComponentType
from zenml.models import (
FlavorRequest,
Expand Down Expand Up @@ -146,9 +147,6 @@ def to_model(
Returns:
The model.
"""
from zenml.client import Client

client = Client()
connector_requirements = self.service_connector_requirements
connector_type = (
connector_requirements.connector_type
Expand All @@ -165,10 +163,16 @@ def to_model(
if connector_requirements
else None
)
user = None
workspace = None
if is_custom:
user = Client().active_user.id
workspace = Client().active_workspace.id

model_class = FlavorRequest if is_custom else InternalFlavorRequest
model = model_class(
user=client.active_user.id if is_custom else None,
workspace=client.active_workspace.id if is_custom else None,
user=user,
workspace=workspace,
name=self.name,
type=self.type,
source=source_utils.resolve(self.__class__).import_path,
Expand Down
Loading