|
|
|
@ -1,11 +1,8 @@
|
|
|
|
import asyncio
|
|
|
|
import asyncio
|
|
|
|
import requests
|
|
|
|
|
|
|
|
from temporalio import activity
|
|
|
|
from temporalio import activity
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import redis.asyncio as redis
|
|
|
|
import redis.asyncio as redis
|
|
|
|
|
|
|
|
|
|
|
|
AHM_BASE_URL = os.getenv("AHM_BASE_URL", "http://192.168.1.82:8000/ahm")
|
|
|
|
|
|
|
|
AHM_SIMULATION_CALLBACK_URL = os.getenv("AHM_SIMULATION_CALLBACK_URL", "/api/v1/simulations/rbd/callback")
|
|
|
|
|
|
|
|
REDIS_HOST = os.getenv("REDIS_HOST", "192.168.1.82")
|
|
|
|
REDIS_HOST = os.getenv("REDIS_HOST", "192.168.1.82")
|
|
|
|
REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))
|
|
|
|
REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))
|
|
|
|
|
|
|
|
|
|
|
|
@ -94,19 +91,13 @@ async def update_contribution_bulk_mappings_activity(sim_id: str):
|
|
|
|
|
|
|
|
|
|
|
|
@activity.defn
|
|
|
|
@activity.defn
|
|
|
|
async def call_callback_ahm(params):
|
|
|
|
async def call_callback_ahm(params):
|
|
|
|
|
|
|
|
from src.aeros_simulation.service import call_ahm_callback_service
|
|
|
|
sim_id = params["simulation_id"]
|
|
|
|
sim_id = params["simulation_id"]
|
|
|
|
job_id = params["job_id"]
|
|
|
|
job_id = params["job_id"]
|
|
|
|
|
|
|
|
|
|
|
|
url = f"{AHM_BASE_URL}{AHM_SIMULATION_CALLBACK_URL}"
|
|
|
|
|
|
|
|
payload = {
|
|
|
|
|
|
|
|
"simulation_id": sim_id,
|
|
|
|
|
|
|
|
"job_id": job_id,
|
|
|
|
|
|
|
|
"status" : "completed"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
callback_response = requests.post(url, json=payload, timeout=5)
|
|
|
|
await call_ahm_callback_service(sim_id, job_id)
|
|
|
|
callback_response.raise_for_status()
|
|
|
|
return True
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
raise e
|
|
|
|
raise e
|
|
|
|
|
|
|
|
|
|
|
|
|