diff --git a/smac/model/random_forest/multiproc_util/GrowingSharedArray.py b/smac/model/random_forest/multiproc_util/GrowingSharedArray.py index 9eda8c406..2a4762137 100644 --- a/smac/model/random_forest/multiproc_util/GrowingSharedArray.py +++ b/smac/model/random_forest/multiproc_util/GrowingSharedArray.py @@ -1,19 +1,20 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import uuid from typing import Optional import math from multiprocessing import Lock +import uuid +import numpy as np +from numpy import typing as npt + # from multiprocessing.shared_memory import SharedMemory from .SharedMemory import SharedMemory as UntrackableSharedMemory -def SharedMemory(*args, **kwargs) -> UntrackableSharedMemory: - return UntrackableSharedMemory(*args, track=False, **kwargs) -import numpy as np -from numpy import typing as npt +def SharedMemory(*args, **kwargs) -> UntrackableSharedMemory: + return UntrackableSharedMemory(*args, track=False, **kwargs) def dtypes_are_equal(dtype1: np.dtype, dtype2: np.dtype) -> bool: diff --git a/smac/model/random_forest/multiproc_util/RFTrainer.py b/smac/model/random_forest/multiproc_util/RFTrainer.py index ffce5196e..365055c97 100644 --- a/smac/model/random_forest/multiproc_util/RFTrainer.py +++ b/smac/model/random_forest/multiproc_util/RFTrainer.py @@ -17,6 +17,13 @@ from enum import Enum, auto, unique +try: + from setproctitle import setproctitle +except ImportError: + setproctitle = None +else: + import uuid + @unique class Concurrency(Enum): @@ -48,6 +55,9 @@ def rf_training_loop( n_trees: int, bootstrapping: bool, max_features: int, min_samples_split: int, min_samples_leaf: int, max_depth: int, eps_purity: float, max_nodes: int, n_points_per_tree: int ) -> None: + if setproctitle is not None: + setproctitle(f'rf_trainer_{uuid.uuid4().int}'[:15]) + rf_opts = get_rf_opts(n_trees, bootstrapping, max_features, min_samples_split, min_samples_leaf, max_depth, eps_purity, max_nodes, n_points_per_tree)