Implement new get_last_timestamp method in Gates class, refactor MLFlow activity methods to return only transformed data, and update PredictionsBatch and PredictionProcess workflows to utilize Activities module. Add detailed docstrings for new methods and enhance test coverage for get_last_timestamp functionality.
31 lines
872 B
Python
31 lines
872 B
Python
from temporalio import workflow
|
|
|
|
with workflow.unsafe.imports_passed_through():
|
|
from laborious.activities.activities import Activities
|
|
from typing import Any
|
|
|
|
|
|
@workflow.defn(name="predictions_batch")
|
|
class PredictionsBatch():
|
|
@workflow.run
|
|
async def run(self, input_data: dict[str, Any]):
|
|
|
|
await workflow.execute_activity_method(
|
|
Activities.prepare_activity,
|
|
{
|
|
'schedule_name': input_data['schedule_name'],
|
|
'model_name': input_data['model_name'],
|
|
'model_id': input_data['model_id']
|
|
}
|
|
)
|
|
|
|
data = await workflow.execute_activity_method(
|
|
Activities.load_custom_query,
|
|
input_data['query']
|
|
)
|
|
|
|
input_data['data'] = data
|
|
|
|
await workflow.execute_child_workflow(
|
|
'prediction_process', input_data)
|