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.
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
import asyncio
|
|
import os
|
|
from temporalio.client import Client
|
|
from temporalio.worker import Worker
|
|
|
|
from temporal.temporal_workflows import OptimumOHCalculationWorkflow
|
|
from temporal.temporal_workflows import create_optimum_oh_calculation, request_rbd_simulation, run_optimum_oh_calculation
|
|
|
|
TEMPORAL_URL = os.environ.get("TEMPORAL_URL", "http://192.168.1.86:7233")
|
|
|
|
async def main():
|
|
client = await Client.connect(TEMPORAL_URL)
|
|
|
|
try:
|
|
worker = Worker(
|
|
client,
|
|
task_queue="oh-sim-queue",
|
|
workflows=[OptimumOHCalculationWorkflow],
|
|
activities=[
|
|
create_optimum_oh_calculation,
|
|
request_rbd_simulation,
|
|
run_optimum_oh_calculation
|
|
],
|
|
max_concurrent_workflow_tasks=50,
|
|
max_concurrent_activities=12
|
|
)
|
|
await worker.run()
|
|
except Exception as e:
|
|
print(f"Worker failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|