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

Proposal for different fix to 2.10 regression #1163

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 0 additions & 24 deletions cosmos/operators/aws_eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,12 @@ class DbtBuildAwsEksOperator(DbtAwsEksBaseOperator, DbtBuildKubernetesOperator):
DbtAwsEksBaseOperator.template_fields + DbtBuildKubernetesOperator.template_fields # type: ignore[operator]
)

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtLSAwsEksOperator(DbtAwsEksBaseOperator, DbtLSKubernetesOperator):
"""
Executes a dbt core ls command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSeedAwsEksOperator(DbtAwsEksBaseOperator, DbtSeedKubernetesOperator):
"""
Expand All @@ -101,27 +95,18 @@ class DbtSeedAwsEksOperator(DbtAwsEksBaseOperator, DbtSeedKubernetesOperator):
DbtAwsEksBaseOperator.template_fields + DbtSeedKubernetesOperator.template_fields # type: ignore[operator]
)

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSnapshotAwsEksOperator(DbtAwsEksBaseOperator, DbtSnapshotKubernetesOperator):
"""
Executes a dbt core snapshot command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSourceAzureContainerInstanceOperator(DbtAwsEksBaseOperator, DbtSourceKubernetesOperator):
"""
Executes a dbt source freshness command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtRunAwsEksOperator(DbtAwsEksBaseOperator, DbtRunKubernetesOperator):
"""
Expand All @@ -132,9 +117,6 @@ class DbtRunAwsEksOperator(DbtAwsEksBaseOperator, DbtRunKubernetesOperator):
DbtAwsEksBaseOperator.template_fields + DbtRunKubernetesOperator.template_fields # type: ignore[operator]
)

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtTestAwsEksOperator(DbtAwsEksBaseOperator, DbtTestKubernetesOperator):
"""
Expand All @@ -145,9 +127,6 @@ class DbtTestAwsEksOperator(DbtAwsEksBaseOperator, DbtTestKubernetesOperator):
DbtAwsEksBaseOperator.template_fields + DbtTestKubernetesOperator.template_fields # type: ignore[operator]
)

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtRunOperationAwsEksOperator(DbtAwsEksBaseOperator, DbtRunOperationKubernetesOperator):
"""
Expand All @@ -157,6 +136,3 @@ class DbtRunOperationAwsEksOperator(DbtAwsEksBaseOperator, DbtRunOperationKubern
template_fields: Sequence[str] = (
DbtAwsEksBaseOperator.template_fields + DbtRunOperationKubernetesOperator.template_fields # type: ignore[operator]
)

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
18 changes: 0 additions & 18 deletions cosmos/operators/azure_container_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ class DbtLSAzureContainerInstanceOperator(DbtLSMixin, DbtAzureContainerInstanceB
Executes a dbt core ls command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSeedAzureContainerInstanceOperator(DbtSeedMixin, DbtAzureContainerInstanceBaseOperator): # type: ignore
"""
Expand All @@ -95,28 +92,19 @@ class DbtSeedAzureContainerInstanceOperator(DbtSeedMixin, DbtAzureContainerInsta

template_fields: Sequence[str] = DbtAzureContainerInstanceBaseOperator.template_fields + DbtRunMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSnapshotAzureContainerInstanceOperator(DbtSnapshotMixin, DbtAzureContainerInstanceBaseOperator): # type: ignore
"""
Executes a dbt core snapshot command.

"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSourceAzureContainerInstanceOperator(DbtSourceMixin, DbtAzureContainerInstanceBaseOperator):
"""
Executes a dbt source freshness command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtRunAzureContainerInstanceOperator(DbtRunMixin, DbtAzureContainerInstanceBaseOperator): # type: ignore
"""
Expand All @@ -125,9 +113,6 @@ class DbtRunAzureContainerInstanceOperator(DbtRunMixin, DbtAzureContainerInstanc

template_fields: Sequence[str] = DbtAzureContainerInstanceBaseOperator.template_fields + DbtRunMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtTestAzureContainerInstanceOperator(DbtTestMixin, DbtAzureContainerInstanceBaseOperator): # type: ignore
"""
Expand All @@ -152,6 +137,3 @@ class DbtRunOperationAzureContainerInstanceOperator(DbtRunOperationMixin, DbtAzu
template_fields: Sequence[str] = (
DbtAzureContainerInstanceBaseOperator.template_fields + DbtRunOperationMixin.template_fields # type: ignore[operator]
)

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
28 changes: 8 additions & 20 deletions cosmos/operators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def execute(self, context: Context) -> Any | None: # type: ignore
self.build_and_run_cmd(context=context, cmd_flags=self.add_cmd_flags())


class DbtBuildMixin:
class DbtBuildMixin(BaseOperator, metaclass=ABCMeta):
"""Mixin for dbt build command."""

base_cmd = ["build"]
Expand All @@ -294,7 +294,7 @@ def add_cmd_flags(self) -> list[str]:
return flags


class DbtLSMixin:
class DbtLSMixin(BaseOperator, metaclass=ABCMeta):
"""
Executes a dbt core ls command.
"""
Expand All @@ -303,7 +303,7 @@ class DbtLSMixin:
ui_color = "#DBCDF6"


class DbtSeedMixin:
class DbtSeedMixin(BaseOperator, metaclass=ABCMeta):
"""
Mixin for dbt seed operation command.

Expand Down Expand Up @@ -334,14 +334,14 @@ def add_cmd_flags(self) -> list[str]:
return flags


class DbtSnapshotMixin:
class DbtSnapshotMixin(BaseOperator, metaclass=ABCMeta):
"""Mixin for a dbt snapshot command."""

base_cmd = ["snapshot"]
ui_color = "#964B00"


class DbtSourceMixin:
class DbtSourceMixin(BaseOperator, metaclass=ABCMeta):
"""
Executes a dbt source freshness command.
"""
Expand All @@ -350,7 +350,7 @@ class DbtSourceMixin:
ui_color = "#34CCEB"


class DbtRunMixin:
class DbtRunMixin(BaseOperator, metaclass=ABCMeta):
"""
Mixin for dbt run command.

Expand Down Expand Up @@ -382,26 +382,14 @@ def add_cmd_flags(self) -> list[str]:
return flags


class DbtTestMixin:
class DbtTestMixin(BaseOperator, metaclass=ABCMeta):
"""Mixin for dbt test command."""

base_cmd = ["test"]
ui_color = "#8194E0"

def __init__(
self,
exclude: str | None = None,
select: str | None = None,
selector: str | None = None,
**kwargs: Any,
) -> None:
self.select = select
self.exclude = exclude
self.selector = selector
super().__init__(exclude=exclude, select=select, selector=selector, **kwargs) # type: ignore


class DbtRunOperationMixin:
class DbtRunOperationMixin(BaseOperator, metaclass=ABCMeta):
"""
Mixin for dbt run operation command.

Expand Down
21 changes: 0 additions & 21 deletions cosmos/operators/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,12 @@ class DbtBuildDockerOperator(DbtBuildMixin, DbtDockerBaseOperator):

template_fields: Sequence[str] = DbtDockerBaseOperator.template_fields + DbtBuildMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtLSDockerOperator(DbtLSMixin, DbtDockerBaseOperator):
"""
Executes a dbt core ls command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSeedDockerOperator(DbtSeedMixin, DbtDockerBaseOperator):
"""
Expand All @@ -91,27 +85,18 @@ class DbtSeedDockerOperator(DbtSeedMixin, DbtDockerBaseOperator):

template_fields: Sequence[str] = DbtDockerBaseOperator.template_fields + DbtSeedMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSnapshotDockerOperator(DbtSnapshotMixin, DbtDockerBaseOperator):
"""
Executes a dbt core snapshot command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSourceDockerOperator(DbtSourceMixin, DbtDockerBaseOperator):
"""
Executes a dbt source freshness command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtRunDockerOperator(DbtRunMixin, DbtDockerBaseOperator):
"""
Expand All @@ -120,9 +105,6 @@ class DbtRunDockerOperator(DbtRunMixin, DbtDockerBaseOperator):

template_fields: Sequence[str] = DbtDockerBaseOperator.template_fields + DbtRunMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtTestDockerOperator(DbtTestMixin, DbtDockerBaseOperator):
"""
Expand All @@ -145,6 +127,3 @@ class DbtRunOperationDockerOperator(DbtRunOperationMixin, DbtDockerBaseOperator)
"""

template_fields: Sequence[str] = DbtDockerBaseOperator.template_fields + DbtRunOperationMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
21 changes: 0 additions & 21 deletions cosmos/operators/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,12 @@ class DbtBuildKubernetesOperator(DbtBuildMixin, DbtKubernetesBaseOperator):

template_fields: Sequence[str] = DbtKubernetesBaseOperator.template_fields + DbtBuildMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtLSKubernetesOperator(DbtLSMixin, DbtKubernetesBaseOperator):
"""
Executes a dbt core ls command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSeedKubernetesOperator(DbtSeedMixin, DbtKubernetesBaseOperator):
"""
Expand All @@ -122,27 +116,18 @@ class DbtSeedKubernetesOperator(DbtSeedMixin, DbtKubernetesBaseOperator):

template_fields: Sequence[str] = DbtKubernetesBaseOperator.template_fields + DbtSeedMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSnapshotKubernetesOperator(DbtSnapshotMixin, DbtKubernetesBaseOperator):
"""
Executes a dbt core snapshot command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtSourceKubernetesOperator(DbtSourceMixin, DbtKubernetesBaseOperator):
"""
Executes a dbt source freshness command.
"""

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtRunKubernetesOperator(DbtRunMixin, DbtKubernetesBaseOperator):
"""
Expand All @@ -151,9 +136,6 @@ class DbtRunKubernetesOperator(DbtRunMixin, DbtKubernetesBaseOperator):

template_fields: Sequence[str] = DbtKubernetesBaseOperator.template_fields + DbtRunMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


class DbtTestKubernetesOperator(DbtTestMixin, DbtKubernetesBaseOperator):
"""
Expand Down Expand Up @@ -257,6 +239,3 @@ class DbtRunOperationKubernetesOperator(DbtRunOperationMixin, DbtKubernetesBaseO
"""

template_fields: Sequence[str] = DbtKubernetesBaseOperator.template_fields + DbtRunOperationMixin.template_fields # type: ignore[operator]

def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
Loading