Skip to content

Commit

Permalink
fix: remove debug code
Browse files Browse the repository at this point in the history
Signed-off-by: seolmin <seolmin@megazone.com>
  • Loading branch information
stat-kwon committed Dec 30, 2024
1 parent f43a3dd commit cbe7f20
Showing 1 changed file with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,24 @@ def load(
end: str = None,
vars: dict = None,
) -> pd.DataFrame:
# try:
start, end = self._get_time_from_granularity(granularity, start, end)
try:
start, end = self._get_time_from_granularity(granularity, start, end)

if self.source_type == "COST":
self._analyze_cost(granularity, start, end, vars)
elif self.source_type == "ASSET":
self._analyze_asset(granularity, start, end, vars)
_LOGGER.debug(f"[before load] {self.df}")
if self.timediff:
self.df = self._apply_timediff(granularity, start, end, vars)
if self.source_type == "COST":
self._analyze_cost(granularity, start, end, vars)
elif self.source_type == "ASSET":
self._analyze_asset(granularity, start, end, vars)

_LOGGER.debug(f"[after load] {self.df}")
if self.timediff:
self.df = self._apply_timediff(granularity, start, end, vars)

self.state = "AVAILABLE"
self.error_message = None
self.state = "AVAILABLE"
self.error_message = None

# except Exception as 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}")
except Exception as 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

Expand Down Expand Up @@ -192,9 +190,13 @@ def _apply_timediff(
self._analyze_cost(granularity, start, end, vars)
elif self.source_type == "ASSET":
self._analyze_asset(granularity, start, end, vars)
_LOGGER.debug(f"[timediff] {self.timediff}")
_LOGGER.debug(f"[origin_df column] {origin_df.columns}")
_LOGGER.debug(f"[self.df column] {self.df.columns}")

if self.df.empty:
_LOGGER.debug(
"self.df is empty, creating a DataFrame with the same columns as origin_df."
)
self.df = pd.DataFrame(columns=origin_df.columns)

self.df["Date"] = self.df["Date"].apply(
lambda x: self._change_date_by_timediff(x)
)
Expand All @@ -208,10 +210,6 @@ def _apply_timediff(
]
join_keys = list(set(origin_label_keys) & set(diff_label_keys))

_LOGGER.debug(f"[origin_label_keys] {origin_label_keys}")
_LOGGER.debug(f"[diff_label_keys] {diff_label_keys}")
_LOGGER.debug(f"[join_keys] {join_keys}")

merged_df = pd.merge(origin_df, self.df, on=join_keys, how="left")

fill_na = {key: 0 for key in [self.data_name, self.timediff_data_name]}
Expand Down

0 comments on commit cbe7f20

Please sign in to comment.