diff --git a/backend/src/backend/experiments/calc_surf_isec_custom.py b/backend/src/backend/experiments/calc_surf_isec_custom.py index 3d0cd9d36..651d424a5 100644 --- a/backend/src/backend/experiments/calc_surf_isec_custom.py +++ b/backend/src/backend/experiments/calc_surf_isec_custom.py @@ -45,11 +45,12 @@ async def calc_surf_isec_custom( name: str, attribute: str, num_reals: int, + num_workers: int, cutting_plane: schemas.CuttingPlane, ) -> List[schemas.SurfaceIntersectionData]: myprefix = ">>>>>>>>>>>>>>>>> calc_surf_isec_custom():" - print(f"{myprefix} started with {num_reals=}", flush=True) + print(f"{myprefix} started with {num_reals=} {num_workers=}", flush=True) perf_metrics.reset_lap_timer() @@ -63,7 +64,7 @@ async def calc_surf_isec_custom( multi_queue = multiprocessing.Queue() async_queue = AsyncQueue(multi_queue) - num_procs=4 + num_procs=num_workers proc_arr = [] for proc_num in range(num_procs): p = multiprocessing.Process(target=process_surf_worker, args=(f"sigworker{proc_num}", multi_queue, fence_arr)) @@ -95,7 +96,8 @@ async def calc_surf_isec_custom( async def load_surf_bytes_task(queue, access: SurfaceAccess, real_num: int, name: str, attribute: str): surf_bytes = await access.get_realization_surface_bytes_async(real_num=real_num, name=name, attribute=attribute) - await queue.put(surf_bytes) + if surf_bytes is not None: + await queue.put(surf_bytes) def process_surf_worker(workerName, queue, fence_arr): diff --git a/backend/src/backend/user_session/routers/surface/router.py b/backend/src/backend/user_session/routers/surface/router.py index 1dde05f33..cbb7bb898 100644 --- a/backend/src/backend/user_session/routers/surface/router.py +++ b/backend/src/backend/user_session/routers/surface/router.py @@ -61,7 +61,7 @@ async def post_calc_surf_isec_experiments( #intersections = await calc_surf_isec_fetch_first(perf_metrics, authenticated_user, case_uuid, ensemble_name, name, attribute, num_reals, cutting_plane) #intersections = await calc_surf_isec_queue(perf_metrics, authenticated_user, case_uuid, ensemble_name, name, attribute, num_reals, num_workers, cutting_plane) #intersections = await calc_surf_isec_multiprocess(perf_metrics, authenticated_user, case_uuid, ensemble_name, name, attribute, num_reals, cutting_plane) - intersections = await calc_surf_isec_custom(perf_metrics, authenticated_user, case_uuid, ensemble_name, name, attribute, num_reals, cutting_plane) + intersections = await calc_surf_isec_custom(perf_metrics, authenticated_user, case_uuid, ensemble_name, name, attribute, num_reals, num_workers, cutting_plane) LOGGER.debug(f"route calc_surf_isec_experiments - intersected {len(intersections)} surfaces in: {perf_metrics.to_string()}")