(self, name, location)
return node
Load node info & status
Load node info & status
Load node info & status
def load_node_status (self, name, location):
        """ Load node info & status """
        # must be thread-safe (!)
        if not self.node_alive(name):
            node = NodeInfo(self.queue_name, None, node_name = name)
            return node
        try:
            db = None
            db = skytools.connect_database (location)
            db.set_isolation_level (skytools.I_AUTOCOMMIT)
            curs = db.cursor()
            curs.execute("select * from pgq_node.get_node_info(%s)", [self.queue_name])
            node = NodeInfo(self.queue_name, curs.fetchone())
            node.load_status(curs)
            self.load_extra_status(curs, node)
        except DBError, d:
            msg = str(d).strip().split('\n', 1)[0].strip()
            print('Node %r failure: %s' % (name, msg))
            node = NodeInfo(self.queue_name, None, node_name = name)
        finally:
            if db: db.close()
        return node
def load_node_status ( self , name , location ) : # must be thread-safe (!) if not self . node_alive ( name ) : node = NodeInfo ( self . queue_name , None , node_name = name ) return node try : db = None db = skytools . connect_database ( location ) db . set_isolation_level ( skytools . I_AUTOCOMMIT ) curs = db . cursor ( ) curs . execute ( "select * from pgq_node.get_node_info(%s)" , [ self . queue_name ] ) node = NodeInfo ( self . queue_name , curs . fetchone ( ) ) node . load_status ( curs ) self . load_extra_status ( curs , node ) except DBError , d : msg = str ( d ) . strip ( ) . split ( '\n' , 1 ) [ 0 ] . strip ( ) print ( 'Node %r failure: %s' % ( name , msg ) ) node = NodeInfo ( self . queue_name , None , node_name = name ) finally : if db : db . close ( ) return node