|
|
|
|
@ -93,44 +93,6 @@ async def run_simulations(
|
|
|
|
|
sim_data["HubCnnId"] = str(simulation_id)
|
|
|
|
|
sim_data["projectName"] = project.project_name
|
|
|
|
|
|
|
|
|
|
# # Prepare async background task
|
|
|
|
|
# async def run_full_simulation():
|
|
|
|
|
# try:
|
|
|
|
|
# results = await update_equipment_for_simulation(
|
|
|
|
|
# db_session=db_session,
|
|
|
|
|
# project_name=project.project_name,
|
|
|
|
|
# schematic_name=simulation_in.SchematicName,
|
|
|
|
|
# overhaul_duration=simulation_in.OverhaulDuration,
|
|
|
|
|
# overhaul_interval=simulation_in.OverhaulInterval,
|
|
|
|
|
# offset=simulation_in.OffSet,
|
|
|
|
|
# custom_input=simulation_in.CustomInput,
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
# await execute_simulation(
|
|
|
|
|
# db_session=db_session,
|
|
|
|
|
# simulation_id=simulation_id,
|
|
|
|
|
# sim_data=sim_data,
|
|
|
|
|
# is_saved=True,
|
|
|
|
|
# eq_update=results,
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
# await calculate_plant_eaf(
|
|
|
|
|
# db_session=db_session,
|
|
|
|
|
# simulation_id=simulation_id,
|
|
|
|
|
# is_default=simulation_in.IsDefault,
|
|
|
|
|
# konkin_offset=simulation_in.Konkin_offset,
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
# await update_contribution_bulk_mappings(
|
|
|
|
|
# db_session=db_session, simulation_id=simulation_id
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
# except Exception as e:
|
|
|
|
|
# # TODO: log error into DB or logger
|
|
|
|
|
# print(f"Simulation {simulation_id} failed: {e}")
|
|
|
|
|
|
|
|
|
|
# # Add to background
|
|
|
|
|
# background_tasks.add_task(run_full_simulation)
|
|
|
|
|
|
|
|
|
|
handle = await temporal_client.start_workflow(
|
|
|
|
|
SimulationWorkflow.run,
|
|
|
|
|
|