diff options
Diffstat (limited to 'robusta_krr')
| -rw-r--r-- | robusta_krr/core/models/config.py | 7 | ||||
| -rw-r--r-- | robusta_krr/core/runner.py | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/robusta_krr/core/models/config.py b/robusta_krr/core/models/config.py index 1d4e6a5..dd84423 100644 --- a/robusta_krr/core/models/config.py +++ b/robusta_krr/core/models/config.py @@ -65,7 +65,6 @@ class Config(pd.BaseSettings): # Internal inside_cluster: bool = False _logging_console: Optional[Console] = pd.PrivateAttr(None) - _result_console: Optional[Console] = pd.PrivateAttr(None) def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) @@ -132,12 +131,6 @@ class Config(pd.BaseSettings): self._logging_console = Console(file=sys.stderr if self.log_to_stderr else sys.stdout, width=self.width) return self._logging_console - @property - def result_console(self) -> Console: - if getattr(self, "_result_console") is None: - self._result_console = Console(file=sys.stdout, width=self.width) - return self._result_console - def load_kubeconfig(self) -> None: try: config.load_incluster_config() diff --git a/robusta_krr/core/runner.py b/robusta_krr/core/runner.py index 4aacfb5..f651aa8 100644 --- a/robusta_krr/core/runner.py +++ b/robusta_krr/core/runner.py @@ -8,6 +8,7 @@ from concurrent.futures import ThreadPoolExecutor from typing import Optional, Union from datetime import timedelta from prometrix import PrometheusNotFound +from rich.console import Console from slack_sdk import WebClient from robusta_krr.core.abstract.strategies import ResourceRecommendation, RunResult @@ -89,9 +90,8 @@ class Runner: elif settings.slack_output: file_name = settings.slack_output with open(file_name, "w") as target_file: - sys.stdout = target_file - custom_print(formatted, rich=rich, force=True) - sys.stdout = sys.stdout + console = Console(file=target_file, width=settings.width) + console.print(formatted) if settings.slack_output: client = WebClient(os.environ["SLACK_BOT_TOKEN"]) warnings.filterwarnings("ignore", category=UserWarning) |
