From 2d150b32f60407cbb364f4000c33a9560c8d8158 Mon Sep 17 00:00:00 2001 From: Maxwell Lou Date: Fri, 4 Apr 2025 20:39:56 -0400 Subject: [PATCH] Fix parameter ordering issue for workers --- modules/cluster_estimation/cluster_estimation.py | 6 +++--- modules/cluster_estimation/cluster_estimation_worker.py | 4 ++-- modules/detect_target/detect_target_brightspot.py | 4 +--- tests/unit/test_cluster_detection.py | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/cluster_estimation/cluster_estimation.py b/modules/cluster_estimation/cluster_estimation.py index c3d6c082..792b83a3 100644 --- a/modules/cluster_estimation/cluster_estimation.py +++ b/modules/cluster_estimation/cluster_estimation.py @@ -63,8 +63,8 @@ def create( min_new_points_to_run: int, max_num_components: int, random_state: int, - local_logger: logger.Logger, min_points_per_cluster: int, + local_logger: logger.Logger, ) -> "tuple[bool, ClusterEstimation | None]": """ Data requirement conditions for estimation model to run. @@ -111,8 +111,8 @@ def create( min_new_points_to_run, max_num_components, random_state, - local_logger, min_points_per_cluster, + local_logger, ) def __init__( @@ -122,8 +122,8 @@ def __init__( min_new_points_to_run: int, max_num_components: int, random_state: int, - local_logger: logger.Logger, min_points_per_cluster: int, + local_logger: logger.Logger, ) -> None: """ Private constructor, use create() method. diff --git a/modules/cluster_estimation/cluster_estimation_worker.py b/modules/cluster_estimation/cluster_estimation_worker.py index adf275c8..910ed70d 100644 --- a/modules/cluster_estimation/cluster_estimation_worker.py +++ b/modules/cluster_estimation/cluster_estimation_worker.py @@ -18,10 +18,10 @@ def cluster_estimation_worker( min_new_points_to_run: int, max_num_components: int, random_state: int, + min_points_per_cluster: int, input_queue: queue_proxy_wrapper.QueueProxyWrapper, output_queue: queue_proxy_wrapper.QueueProxyWrapper, controller: worker_controller.WorkerController, - min_points_per_cluster: int, ) -> None: """ Estimation worker process. @@ -67,8 +67,8 @@ def cluster_estimation_worker( min_new_points_to_run, max_num_components, random_state, - local_logger, min_points_per_cluster, + local_logger, ) if not result: local_logger.error("Worker failed to create class object", True) diff --git a/modules/detect_target/detect_target_brightspot.py b/modules/detect_target/detect_target_brightspot.py index f8b414cf..c1e84eee 100644 --- a/modules/detect_target/detect_target_brightspot.py +++ b/modules/detect_target/detect_target_brightspot.py @@ -133,9 +133,7 @@ def run( # Catching all exceptions for library call # pylint: disable-next=broad-exception-caught except Exception as exception: - self.__local_logger.error( - f"Failed to convert to greyscale, exception: {exception}" - ) + self.__local_logger.error(f"Failed to convert to greyscale, exception: {exception}") return False, None # Calculate the percentile threshold for bright spots diff --git a/tests/unit/test_cluster_detection.py b/tests/unit/test_cluster_detection.py index 372c5e28..57f39038 100644 --- a/tests/unit/test_cluster_detection.py +++ b/tests/unit/test_cluster_detection.py @@ -37,8 +37,8 @@ def cluster_model() -> cluster_estimation.ClusterEstimation: # type: ignore MIN_NEW_POINTS_TO_RUN, MAX_NUM_COMPONENTS, RNG_SEED, - test_logger, MIN_POINTS_PER_CLUSTER, + test_logger, ) assert result assert model is not None