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

[RPD-305] fix circular import error #201

Merged
merged 1 commit into from
Aug 23, 2023
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
14 changes: 8 additions & 6 deletions src/matcha_ml/runners/base_runner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Run terraform templates to provision and deprovision resources."""
import os
from abc import abstractmethod
from multiprocessing.pool import ThreadPool
from typing import Optional, Tuple
from typing import Any, Optional

import typer

Expand All @@ -18,7 +19,6 @@
TerraformConfig,
TerraformService,
)
from matcha_ml.state.matcha_state import MatchaStateService

SPINNER = "dots"

Expand Down Expand Up @@ -183,10 +183,12 @@ def _destroy_terraform(self, msg: str = "") -> None:
if tf_result.return_code != 0:
raise MatchaTerraformError(tf_error=tf_result.std_err)

def provision(self) -> MatchaStateService:
@abstractmethod
def provision(self) -> Any:
"""Provision resources required for the deployment."""
raise NotImplementedError
pass

def deprovision(self) -> None:
@abstractmethod
def deprovision(self) -> Any:
"""Destroy the provisioned resources."""
raise NotImplementedError
pass
14 changes: 0 additions & 14 deletions tests/test_runners/test_base_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,3 @@ def test_destroy_terraform(capsys: SysCapture):
str(exc_info.value)
== "Terraform failed because of the following error: 'Destroy failed'."
)


def test_provision():
"""Test provision function in BaseRunner class raises NotImplemented exception."""
template_runner = BaseRunner()
with pytest.raises(NotImplementedError):
template_runner.provision()


def test_deprovision():
"""Test deprovision function in BaseRunner class raises NotImplemented exception."""
template_runner = BaseRunner()
with pytest.raises(NotImplementedError):
template_runner.deprovision()