minermedic/pools/helper.py
def process_pool_apis(results, miner, worker, algo, pool):

    """
    Processes all pool APIs for the specific pool

    Returns:
        None

    """

    success = False
    pool_attrs = None
    pool_class = None
    pool_not_supported = False

    if pool not in pool_lookups:

        # get the pool classnames enum
        enum_pools = global_enums.get_enum_details('_POOL_STATS_CLASSNAMES_')

        for enum_pool in enum_pools:

            pool_attrs = enum_pool.value[0]
            pool_url_match = pool_attrs['url_match']
            m = re.search(pool_url_match, pool)

            if m is not None:

                # add the name to the attributes
                pool_attrs['name'] = enum_pool.name

                # add the attributes to the list.
                pool_lookups[pool] = pool_attrs

                break

            else:

                pool_attrs = None

    else:
        pool_attrs = pool_lookups[pool]

    if pool_attrs is not None:

        pool_id = pool_attrs["value"]
        pool_classname = pool_attrs["classname"]

        # get the model class to operate with
        pool_class = locate(pool_classname)

        unit_tests_running = False

        if pool_class is None:
            logger.error("pool classname {} could not be initialized".format(pool_classname))
        else:

            # create the mining pool
            mining_pool = pool_class(pool, pool_attrs)

            try:
                unit_tests_running = sys._unit_tests_running
            except:
                pass

            if not unit_tests_running:

                try:
                    # add the relations (we do not need them for unit tests)
                    mining_pool.relate(miner)
                except Exception as ex:
                    logger.debug(ex)

            # execute the "get_pool_stats(...)" method
            success = mining_pool.get_pool_stats(results, miner, worker, algo, int(pool_id), pool)

    else:
        pool_not_supported = True
        logger.warning("POOL {} not yet supported".format(pool))
        # TODO - issue notification? log an issue on GitHub?

    if success is False and pool_not_supported is False:
        # There is a legitimate error...
        if pool_class is None:
            logger.error("No Pool support found for Pool/Model/Algo {}/{}/{}".format(pool, miner.model.model, algo))
        else:
            logger.error("Pool stats not returned for Pool/Model/Algo {}/{}/{}".format(pool, miner.model.model, algo))

    Processes all pool APIs for the specific pool

    Returns:
        None

    
Processes all pool APIs for the specific pool
Processes all pool APIs for the specific pool
def process_pool_apis(results, miner, worker, algo, pool):
    success = False
    pool_attrs = None
    pool_class = None
    pool_not_supported = False
    if pool not in pool_lookups:
        enum_pools = global_enums.get_enum_details('_POOL_STATS_CLASSNAMES_')
        for enum_pool in enum_pools:
            pool_attrs = enum_pool.value[0]
            pool_url_match = pool_attrs['url_match']
            m = re.search(pool_url_match, pool)
            if m is not None:
                pool_attrs['name'] = enum_pool.name
                pool_lookups[pool] = pool_attrs
                break
            else:
                pool_attrs = None
    else:
        pool_attrs = pool_lookups[pool]
    if pool_attrs is not None:
        pool_id = pool_attrs["value"]
        pool_classname = pool_attrs["classname"]
        pool_class = locate(pool_classname)
        unit_tests_running = False
        if pool_class is None:
            logger.error("pool classname {} could not be initialized".format(pool_classname))
        else:
            mining_pool = pool_class(pool, pool_attrs)
            try:
                unit_tests_running = sys._unit_tests_running
            except:
                pass
            if not unit_tests_running:
                try:
                    mining_pool.relate(miner)
                except Exception as ex:
                    logger.debug(ex)
            success = mining_pool.get_pool_stats(results, miner, worker, algo, int(pool_id), pool)
    else:
        pool_not_supported = True
        logger.warning("POOL {} not yet supported".format(pool))
    if success is False and pool_not_supported is False:
        if pool_class is None:
            logger.error("No Pool support found for Pool/Model/Algo {}/{}/{}".format(pool, miner.model.model, algo))
        else:
            logger.error("Pool stats not returned for Pool/Model/Algo {}/{}/{}".format(pool, miner.model.model, algo))
def process_pool_apis ( results , miner , worker , algo , pool ) : success = False pool_attrs = None pool_class = None pool_not_supported = False if pool not in pool_lookups : enum_pools = global_enums . get_enum_details ( '_POOL_STATS_CLASSNAMES_' ) for enum_pool in enum_pools : pool_attrs = enum_pool . value [ 0 ] pool_url_match = pool_attrs [ 'url_match' ] m = re . search ( pool_url_match , pool ) if m is not None : pool_attrs [ 'name' ] = enum_pool . name pool_lookups [ pool ] = pool_attrs break else : pool_attrs = None else : pool_attrs = pool_lookups [ pool ] if pool_attrs is not None : pool_id = pool_attrs [ "value" ] pool_classname = pool_attrs [ "classname" ] pool_class = locate ( pool_classname ) unit_tests_running = False if pool_class is None : logger . error ( "pool classname {} could not be initialized" . format ( pool_classname ) ) else : mining_pool = pool_class ( pool , pool_attrs ) try : unit_tests_running = sys . _unit_tests_running except : pass if not unit_tests_running : try : mining_pool . relate ( miner ) except Exception as ex : logger . debug ( ex ) success = mining_pool . get_pool_stats ( results , miner , worker , algo , int ( pool_id ) , pool ) else : pool_not_supported = True logger . warning ( "POOL {} not yet supported" . format ( pool ) ) if success is False and pool_not_supported is False : if pool_class is None : logger . error ( "No Pool support found for Pool/Model/Algo {}/{}/{}" . format ( pool , miner . model . model , algo ) ) else : logger . error ( "Pool stats not returned for Pool/Model/Algo {}/{}/{}" . format ( pool , miner . model . model , algo ) )
Processes all pool APIs for the specific pool
Processes all pool APIs for the specific pool
"""
    Processes all pool APIs for the specific pool

    Returns:
        None

    """ # get the pool classnames enum # add the name to the attributes # add the attributes to the list. # get the model class to operate with # create the mining pool # add the relations (we do not need them for unit tests) # execute the "get_pool_stats(...)" method # TODO - issue notification? log an issue on GitHub? # There is a legitimate error...
None
results
miner
worker
algo
pool