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.
64 lines
2.3 KiB
Python
64 lines
2.3 KiB
Python
from temporalio import activity
|
|
|
|
|
|
|
|
@activity.defn
|
|
async def update_equipment_for_simulation_activity(params: dict):
|
|
# ✅ Import inside the activity function
|
|
from src.aeros_equipment.service import update_equipment_for_simulation
|
|
from src.database.core import async_session, async_aeros_session
|
|
|
|
|
|
async with async_session() as db_session, async_aeros_session() as aeros_db_session:
|
|
return await update_equipment_for_simulation(
|
|
db_session=db_session,
|
|
aeros_db_session=aeros_db_session,
|
|
project_name=params["projectName"],
|
|
overhaul_duration=params["OverhaulDuration"],
|
|
overhaul_interval=params["OverhaulInterval"],
|
|
offset=params["OffSet"],
|
|
schematic_name=params["SchematicName"],
|
|
custom_input=params["CustomInput"],
|
|
simulation_duration=params["SimDuration"]
|
|
)
|
|
|
|
|
|
@activity.defn
|
|
async def execute_simulation_activity(params: dict):
|
|
from src.database.core import async_session
|
|
from src.aeros_simulation.simulation_save_service import execute_simulation
|
|
async with async_session() as db_session:
|
|
return await execute_simulation(
|
|
db_session=db_session,
|
|
simulation_id=params["sim_data"]["HubCnnId"],
|
|
sim_data=params["sim_data"],
|
|
is_saved=True,
|
|
eq_update=params["eq_update"]
|
|
)
|
|
|
|
|
|
@activity.defn
|
|
async def calculate_plant_eaf_activity(params: dict):
|
|
from src.aeros_simulation.simulation_save_service import calculate_plant_eaf
|
|
from src.database.core import async_session
|
|
|
|
async with async_session() as db_session:
|
|
return await calculate_plant_eaf(
|
|
db_session=db_session,
|
|
simulation_id=params["HubCnnId"],
|
|
mo_downtime=params["MaintenanceOutages"],
|
|
po_downtime=params["OverhaulDuration"],
|
|
oh_interval=params["OverhaulInterval"]
|
|
)
|
|
|
|
|
|
@activity.defn
|
|
async def update_contribution_bulk_mappings_activity(sim_id: str):
|
|
from src.aeros_contribution.service import update_contribution_bulk_mappings
|
|
from src.database.core import async_session
|
|
|
|
async with async_session() as db_session:
|
|
return await update_contribution_bulk_mappings(
|
|
db_session=db_session,
|
|
simulation_id=sim_id,
|
|
) |