diff --git a/src/firebolt/service/V1/base.py b/src/firebolt/service/V1/base.py index 24b6caea66..2039f320df 100644 --- a/src/firebolt/service/V1/base.py +++ b/src/firebolt/service/V1/base.py @@ -1,11 +1,13 @@ -from typing import Optional +from typing import TYPE_CHECKING, Optional from firebolt.client import ClientV1 as Client -from firebolt.service.manager import ResourceManager + +if TYPE_CHECKING: + from firebolt.service.manager import ResourceManager class BaseService: - def __init__(self, resource_manager: ResourceManager): + def __init__(self, resource_manager: "ResourceManager"): self.resource_manager = resource_manager @property diff --git a/src/firebolt/service/V1/region.py b/src/firebolt/service/V1/region.py index 710894b896..f688e26fa3 100644 --- a/src/firebolt/service/V1/region.py +++ b/src/firebolt/service/V1/region.py @@ -1,14 +1,16 @@ -from typing import Dict, List +from typing import TYPE_CHECKING, Dict, List from firebolt.model.V1.region import Region, RegionKey -from firebolt.service.manager import ResourceManager from firebolt.service.V1.base import BaseService from firebolt.utils.urls import REGIONS_URL from firebolt.utils.util import cached_property +if TYPE_CHECKING: + from firebolt.service.manager import ResourceManager + class RegionService(BaseService): - def __init__(self, resource_manager: ResourceManager): + def __init__(self, resource_manager: "ResourceManager"): """ Service to manage AWS regions (us-east-1, etc) diff --git a/src/firebolt/service/manager.py b/src/firebolt/service/manager.py index 0b66c1d86b..435b072ef5 100644 --- a/src/firebolt/service/manager.py +++ b/src/firebolt/service/manager.py @@ -14,7 +14,14 @@ ) from firebolt.common import Settings from firebolt.db import connect +from firebolt.service.V1.binding import BindingService +from firebolt.service.V1.database import DatabaseService as DatabaseServiceV1 +from firebolt.service.V1.engine import EngineService as EngineServiceV1 from firebolt.service.V1.provider import get_provider_id +from firebolt.service.V1.region import RegionService +from firebolt.service.V2.database import DatabaseService as DatabaseServiceV2 +from firebolt.service.V2.engine import EngineService as EngineServiceV2 +from firebolt.service.V2.instance_type import InstanceTypeService from firebolt.utils.util import fix_url_schema DEFAULT_TIMEOUT_SECONDS: int = 60 * 2 @@ -127,34 +134,25 @@ def __init__( def _init_services_v2(self) -> None: # avoid circular import - from firebolt.service.V2.database import DatabaseService - from firebolt.service.V2.engine import EngineService - from firebolt.service.V2.instance_type import InstanceTypeService # Cloud Platform Resources (AWS) self.instance_types = InstanceTypeService(resource_manager=self) # Firebolt Resources - self.databases = DatabaseService(resource_manager=self) - self.engines = EngineService(resource_manager=self) + self.databases = DatabaseServiceV2(resource_manager=self) + self.engines = EngineServiceV2(resource_manager=self) # Not applicable to V2 self.provider_id = None def _init_services_v1(self) -> None: - # avoid circular import - from firebolt.service.V1.binding import BindingService - from firebolt.service.V1.database import DatabaseService - from firebolt.service.V1.engine import EngineService - from firebolt.service.V1.region import RegionService - # Cloud Platform Resources (AWS) self.regions = RegionService(resource_manager=self) # type: ignore # Firebolt Resources self.bindings = BindingService(resource_manager=self) # type: ignore - self.engines = EngineService(resource_manager=self) # type: ignore - self.databases = DatabaseService(resource_manager=self) # type: ignore + self.engines = EngineServiceV1(resource_manager=self) # type: ignore + self.databases = DatabaseServiceV1(resource_manager=self) # type: ignore self.provider_id = get_provider_id(client=self._client)