Skip to content

Commit

Permalink
Don't initialize client during flavor sync (#3168)
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi authored Nov 5, 2024
1 parent 032e695 commit 4dd7463
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit 4dd7463

Please sign in to comment.