minermedic/pools/base_pool.py
def relate(self, miner):

        """
        Creates a relationship between the Miner and the Mining Pool

        Returns:
                None
        """

        try:

            from phenome_core.core.database.db import db_session

            # by default we will not update db
            updated_db = False

            # find out if there is a relationship from this miner to this pool
            if miner.has_relation(self._pool_object) == False:

                # get the "MINING_ON" relationship
                rtype_id = get_relation_type_id('MINING_ON')

                # add the relation
                miner.add_relation(self._pool_object, rtype_id, None)

                # commit so the model will fill in the relation objects, etc.
                db_session.commit()

            # are there any relations of classtype MINING POOL
            relations = miner.get_relations_by_classtype(get_model_classtype_id_by_name(self.CLASSTYPE))

            if relations:

                # reset the flag
                updated_db = False

                # iterate through relations to pools, and disable all relations except for the one to the current pool
                for r in relations:
                    if r.object_to is not None and r.object_to.id == self._pool_object.id:
                        if r.enabled == False:
                            r.enabled = True
                            updated_db = True
                    elif r.enabled == True:
                        r.enabled = False
                        updated_db = True

                if updated_db:
                    db_session.commit()

        except:
            logger.error("ERROR creating relationship between miner '{}' to pool '{}'".format(miner.id, self._pool_object.unique_id))

        Creates a relationship between the Miner and the Mining Pool

        Returns:
                None
        
Creates a relationship between the Miner and the Mining Pool
Creates a relationship between the Miner and the Mining Pool
def relate(self, miner):
        try:
            from phenome_core.core.database.db import db_session
            updated_db = False
            if miner.has_relation(self._pool_object) == False:
                rtype_id = get_relation_type_id('MINING_ON')
                miner.add_relation(self._pool_object, rtype_id, None)
                db_session.commit()
            relations = miner.get_relations_by_classtype(get_model_classtype_id_by_name(self.CLASSTYPE))
            if relations:
                updated_db = False
                for r in relations:
                    if r.object_to is not None and r.object_to.id == self._pool_object.id:
                        if r.enabled == False:
                            r.enabled = True
                            updated_db = True
                    elif r.enabled == True:
                        r.enabled = False
                        updated_db = True
                if updated_db:
                    db_session.commit()
        except:
            logger.error("ERROR creating relationship between miner '{}' to pool '{}'".format(miner.id, self._pool_object.unique_id))
def relate ( self , miner ) : try : from phenome_core . core . database . db import db_session updated_db = False if miner . has_relation ( self . _pool_object ) == False : rtype_id = get_relation_type_id ( 'MINING_ON' ) miner . add_relation ( self . _pool_object , rtype_id , None ) db_session . commit ( ) relations = miner . get_relations_by_classtype ( get_model_classtype_id_by_name ( self . CLASSTYPE ) ) if relations : updated_db = False for r in relations : if r . object_to is not None and r . object_to . id == self . _pool_object . id : if r . enabled == False : r . enabled = True updated_db = True elif r . enabled == True : r . enabled = False updated_db = True if updated_db : db_session . commit ( ) except : logger . error ( "ERROR creating relationship between miner '{}' to pool '{}'" . format ( miner . id , self . _pool_object . unique_id ) )
Creates a relationship between the Miner and the Mining Pool
Creates a relationship between the Miner and the Mining Pool
"""
        Creates a relationship between the Miner and the Mining Pool

        Returns:
                None
        """ # by default we will not update db # find out if there is a relationship from this miner to this pool # get the "MINING_ON" relationship # add the relation # commit so the model will fill in the relation objects, etc. # are there any relations of classtype MINING POOL # reset the flag # iterate through relations to pools, and disable all relations except for the one to the current pool
None
self
miner