|
|
|
|
@ -7,9 +7,17 @@ from temporal.activity import calculate_plant_eaf_activity, execute_simulation_a
|
|
|
|
|
|
|
|
|
|
@workflow.defn
|
|
|
|
|
class SimulationWorkflow:
|
|
|
|
|
status = "PENDING"
|
|
|
|
|
|
|
|
|
|
@workflow.query
|
|
|
|
|
def get_status(self) -> str:
|
|
|
|
|
return self.status
|
|
|
|
|
|
|
|
|
|
@workflow.run
|
|
|
|
|
async def run(self, sim_data: dict) -> str:
|
|
|
|
|
# 1. Update equipment
|
|
|
|
|
self.status = "RUNNING"
|
|
|
|
|
|
|
|
|
|
# 1. Update equipment for simulation
|
|
|
|
|
results = await workflow.execute_activity(
|
|
|
|
|
update_equipment_for_simulation_activity,
|
|
|
|
|
{**sim_data}, # ✅ one positional argument
|
|
|
|
|
@ -36,5 +44,6 @@ class SimulationWorkflow:
|
|
|
|
|
start_to_close_timeout=timedelta(days=1)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.status = "COMPLETED"
|
|
|
|
|
# etc…
|
|
|
|
|
return sim_data["HubCnnId"] # simulation_id
|
|
|
|
|
|