mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
Add second task queue to make demo easier.
Legacy (initially broken) activity will run on this task queue.
This commit is contained in:
32
scripts/run_legacy_worker.py
Normal file
32
scripts/run_legacy_worker.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import asyncio
|
||||
|
||||
import concurrent.futures
|
||||
|
||||
from temporalio.worker import Worker
|
||||
|
||||
from activities.tool_activities import dynamic_tool_activity
|
||||
|
||||
from shared.config import get_temporal_client, TEMPORAL_LEGACY_TASK_QUEUE
|
||||
|
||||
|
||||
async def main():
|
||||
# Create the client
|
||||
client = await get_temporal_client()
|
||||
|
||||
# Run the worker
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as activity_executor:
|
||||
worker = Worker(
|
||||
client,
|
||||
task_queue=TEMPORAL_LEGACY_TASK_QUEUE,
|
||||
activities=[
|
||||
dynamic_tool_activity,
|
||||
],
|
||||
activity_executor=activity_executor,
|
||||
)
|
||||
|
||||
print(f"Starting legacy worker, connecting to task queue: {TEMPORAL_LEGACY_TASK_QUEUE}")
|
||||
await worker.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user