You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
# src/scripts/run_migration.py
|
|
import asyncio
|
|
from temporalio.client import Client
|
|
from temporalio.worker import Worker
|
|
from workflows.historical_migration import DataMigrationWorkflow, fetch_data_activity, transform_data_activity, validate_data_activity, load_data_activity
|
|
|
|
|
|
async def main():
|
|
# Create Temporal client
|
|
client = await Client.connect("192.168.1.82:7233")
|
|
|
|
# Create worker
|
|
worker = Worker(
|
|
client,
|
|
task_queue="migration-queue",
|
|
workflows=[DataMigrationWorkflow],
|
|
activities=[
|
|
fetch_data_activity,
|
|
transform_data_activity,
|
|
validate_data_activity,
|
|
load_data_activity
|
|
]
|
|
)
|
|
|
|
# Start worker
|
|
await worker.run()
|
|
|
|
# # Start workflow
|
|
# handle = await client.start_workflow(
|
|
# DataMigrationWorkflow.run,
|
|
# id="data-migration",
|
|
# task_queue="migration-queue"
|
|
# )
|
|
|
|
# result = await handle.result()
|
|
# print(f"Migration completed: {result}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|