|
|
|
|
@ -5,6 +5,7 @@ import os
|
|
|
|
|
with workflow.unsafe.imports_passed_through():
|
|
|
|
|
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,execute_update_node
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEMPORAL_URL = os.environ.get("TEMPORAL_URL", "http://192.168.1.86:7233")
|
|
|
|
|
|
|
|
|
|
@workflow.defn
|
|
|
|
|
@ -68,14 +69,26 @@ class SimulationWorkflow:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sim_data.get("AhmJobId"):
|
|
|
|
|
await workflow.execute_activity(
|
|
|
|
|
call_callback_ahm,
|
|
|
|
|
{
|
|
|
|
|
"simulation_id": sim_data["HubCnnId"],
|
|
|
|
|
"job_id": sim_data["AhmJobId"]
|
|
|
|
|
},
|
|
|
|
|
start_to_close_timeout=timedelta(days=1)
|
|
|
|
|
)
|
|
|
|
|
job_id = sim_data["AhmJobId"]
|
|
|
|
|
sim_id = sim_data["HubCnnId"]
|
|
|
|
|
if "|" in job_id:
|
|
|
|
|
wf_id, sim_type = job_id.split("|", 1)
|
|
|
|
|
else:
|
|
|
|
|
wf_id = job_id
|
|
|
|
|
sim_type = "unknown"
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
handle = workflow.get_external_workflow_handle(wf_id)
|
|
|
|
|
await handle.signal(
|
|
|
|
|
"rbd_simulation_completed",
|
|
|
|
|
{
|
|
|
|
|
"sim_id": sim_id,
|
|
|
|
|
"type": sim_type,
|
|
|
|
|
"status": "completed"
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
workflow.logger.error(f"Failed to signal OpsDock: {e}")
|
|
|
|
|
|
|
|
|
|
self.status = "COMPLETED"
|
|
|
|
|
# etc…
|
|
|
|
|
|