Commit 93718f17 authored by David Hendriks's avatar David Hendriks
Browse files

fixed some thread name stuff

parent 89c2cd14
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import datetime
import argparse
import importlib.util
import multiprocessing
import setproctitle

from typing import Union, Any
from pathos.helpers import mp as pathos_multiprocess
@@ -142,6 +143,10 @@ class Population:
        # Create location where ensemble results are written to
        self.grid_ensemble_results = {}

        # Set process name
        setproctitle.setproctitle('binarycpython parent process')
        setproctitle.setthreadtitle("binarycpyhon parent thread")

    ###################################################
    # Argument functions
    ###################################################
@@ -1051,12 +1056,14 @@ class Population:

    def _process_run_population_grid(self, job_queue, result_queue, ID):
        """
        Function that loops over the whole generator, but only runs
        systems that fit to: if (localcounter+ID) % self.grid_options["amt_cores"] == 0
        Worker process that gets items from the job_queue and runs those systems. 
        It keeps track of several things like failed systems, total time spent on systems etc.

        That way with e.g. 4 processes, process 1 runs sytem 0, 4, 8... process 2 runs system 1, 5, 9..., etc
        Input:
            job_queue: Queue object containing system dicts
            result_queue: Queue where the resulting analytic dictionaries will be put in
            ID: id of the worker process

        This function is called by _evolve_population_grid
        """

        # set start timer
@@ -1070,6 +1077,12 @@ class Population:
        stream_logger = self.get_stream_logger()
        stream_logger.debug(f"Setting up processor: process-{self.process_ID}")

        # Set the process names
        name = 'binarycpython population thread {}'.format(ID)
        name_proc = 'binarycpython population process {}'.format(ID)
        setproctitle.setproctitle(name_proc)
        setproctitle.setthreadtitle(name)

        # Set to starting up
        with open(
            os.path.join(
+1 −0
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ setup(
        "astropy",
        "matplotlib",
        "py_rinterpolate",
        "setproctitle",
    ],
    include_package_data=True,
    ext_modules=[BINARY_C_PYTHON_API_MODULE],  # binary_c must be loaded