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.3 KiB
Python
40 lines
1.3 KiB
Python
import asyncio
|
|
import os
|
|
from temporalio.client import Client
|
|
from temporalio.worker import Worker
|
|
|
|
from temporal.activity import calculate_plant_eaf_activity, execute_simulation_activity, update_contribution_bulk_mappings_activity, update_equipment_for_simulation_activity, call_callback_ahm, acquire_lock, release_lock
|
|
from temporal.workflow import SimulationWorkflow
|
|
|
|
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="simulation-task-queue",
|
|
workflows=[SimulationWorkflow],
|
|
activities=[
|
|
update_equipment_for_simulation_activity,
|
|
execute_simulation_activity,
|
|
calculate_plant_eaf_activity,
|
|
update_contribution_bulk_mappings_activity,
|
|
call_callback_ahm,
|
|
acquire_lock,
|
|
release_lock
|
|
],
|
|
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())
|