From 73b4eb7da353d7dfb6158de156693c5660540c39 Mon Sep 17 00:00:00 2001 From: seolmin Date: Tue, 5 Nov 2024 21:34:18 +0900 Subject: [PATCH] feat: modify state option logic for success Signed-off-by: seolmin --- .../manager/data_table_manager/data_source_manager.py | 6 +++++- .../data_table_manager/data_transformation_manager.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/spaceone/dashboard/manager/data_table_manager/data_source_manager.py b/src/spaceone/dashboard/manager/data_table_manager/data_source_manager.py index d0b84aa..19de655 100644 --- a/src/spaceone/dashboard/manager/data_table_manager/data_source_manager.py +++ b/src/spaceone/dashboard/manager/data_table_manager/data_source_manager.py @@ -115,9 +115,13 @@ def load( if additional_labels := self.options.get("additional_labels"): self._add_labels(additional_labels) + + self.state = "AVAILABLE" + self.error_message = None + except Exception as e: - self.error_message = e.message if hasattr(e, "message") else str(e) self.state = "UNAVAILABLE" + self.error_message = e.message if hasattr(e, "message") else str(e) _LOGGER.error(f"[load] add {self.source_type} source error: {e}") return self.df diff --git a/src/spaceone/dashboard/manager/data_table_manager/data_transformation_manager.py b/src/spaceone/dashboard/manager/data_table_manager/data_transformation_manager.py index 1f3e201..8b42bf4 100644 --- a/src/spaceone/dashboard/manager/data_table_manager/data_transformation_manager.py +++ b/src/spaceone/dashboard/manager/data_table_manager/data_transformation_manager.py @@ -91,9 +91,13 @@ def load( self.query_data_table(granularity, start, end, vars) elif self.operator == "EVAL": self.evaluate_data_table(granularity, start, end, vars) + + self.state = "AVAILABLE" + self.error_message = None + except Exception as e: - self.error_message = e.message if hasattr(e, "message") else str(e) self.state = "UNAVAILABLE" + self.error_message = e.message if hasattr(e, "message") else str(e) _LOGGER.error(f"[load] {self.operator} operation error: {e}") return self.df