Files
sientia-dataops-scouter_tem…/scouter/workflow/fake_data.py
vitor-aignosi 7dbb9a29ea SIENTIAPDE-1094
Update environment configuration and refactor activity imports

- Changed Kafka, Redis, and Temporal host configurations to use localhost.
- Updated the version reference for the sientia-dataops-library in requirements.txt.
- Refactored import paths for activities to align with new module structure.
- Removed unused base.py and postgres.py files.
- Updated logger and policies imports to reflect new module locations.
- Adjusted values.yaml for branch and log level settings.
2025-06-09 09:43:06 -03:00

29 lines
899 B
Python

from temporalio import workflow
with workflow.unsafe.imports_passed_through():
from scouter.activities.faker import Faker
from datetime import timedelta
from typing import Dict, Any
from sientia_do.temporal.utils.policies import retry_policy
@workflow.defn(name="fake_data")
class FakeData:
@workflow.run
async def run(self, workflow_input: Dict[str, Any]) -> str:
"""
Generates random data and sends it to a Kafka topic.
Args:
workflow_input (dict[str, Any]): The input data containing:
topic (str): The Kafka topic to send data to
"""
await workflow.execute_activity_method(
Faker.generate_and_send_data,
{
'topic': workflow_input['topic']
},
retry_policy=retry_policy,
start_to_close_timeout=timedelta(seconds=60)
)