SIENTIAPDE-1110
Update dependencies and enhance logging in activities; bump version in requirements and values.yaml
This commit is contained in:
@@ -6,9 +6,9 @@ from temporalio import activity, workflow
|
||||
with workflow.unsafe.imports_passed_through():
|
||||
from sientia_do.temporal.activities.base import BaseActivity
|
||||
from sientia_do.notifications.handlers import NotificationHandler
|
||||
from sientia_do.temporal.utils.logger import Logger
|
||||
from laborious.utils.repository.model_repository import MLFlowRepository
|
||||
from typing import Any
|
||||
from logging import Logger
|
||||
|
||||
|
||||
class MLFlow(BaseActivity):
|
||||
@@ -36,13 +36,14 @@ class MLFlow(BaseActivity):
|
||||
Returns:
|
||||
dict[str, Any]: The transformed data.
|
||||
"""
|
||||
self.logger.info('Transforming data...')
|
||||
metadata = input_data['metadata']
|
||||
self.debug('Transforming data...', metadata)
|
||||
data = DataFrame(input_data['data'])
|
||||
model_name = input_data['model_name']
|
||||
model_retention = input_data['model_retention']
|
||||
|
||||
self.logger.debug("Raw input data:")
|
||||
self.logger.debug(data)
|
||||
self.debug("Raw input data:", metadata)
|
||||
self.debug(data, metadata)
|
||||
|
||||
# Sort by created_at in descending order and keep first occurrence of each variable/timestamp pair
|
||||
data = data.sort_values('created_at', ascending=False).drop_duplicates(
|
||||
@@ -56,14 +57,14 @@ class MLFlow(BaseActivity):
|
||||
data.reset_index(inplace=True)
|
||||
data.columns.name = None
|
||||
|
||||
self.logger.debug("Processed input data:")
|
||||
self.logger.debug(data)
|
||||
self.debug("Processed input data:", metadata)
|
||||
self.debug(data, metadata)
|
||||
|
||||
response_data = self.model_monitoring_repository.transform(
|
||||
model_name, data, model_retention)
|
||||
|
||||
self.logger.debug("Response data:")
|
||||
self.logger.debug(response_data)
|
||||
self.debug("Response data:", metadata)
|
||||
self.debug(response_data, metadata)
|
||||
|
||||
return response_data
|
||||
|
||||
@@ -79,18 +80,19 @@ class MLFlow(BaseActivity):
|
||||
Returns:
|
||||
dict[str, Any]: The predicted data.
|
||||
"""
|
||||
self.logger.info('Predicting data...')
|
||||
metadata = input_data['metadata']
|
||||
self.debug('Predicting data...', metadata)
|
||||
data = DataFrame(input_data['data'])
|
||||
model_name = input_data['model_name']
|
||||
model_retention = input_data['model_retention']
|
||||
|
||||
self.logger.debug(data)
|
||||
self.debug(data, metadata)
|
||||
|
||||
data.replace(np.nan, None, inplace=True)
|
||||
|
||||
response_data = self.model_monitoring_repository.predict(
|
||||
model_name, data, model_retention)
|
||||
|
||||
self.logger.debug(response_data)
|
||||
self.debug(response_data, metadata)
|
||||
|
||||
return response_data
|
||||
|
||||
Reference in New Issue
Block a user