Example #1
0
 def __init__(self):
     self.logger = UserLogger.getlog()
     """当前服务器IP地址"""
     self.public_ip = BusinessUtil.get_public_ip()
     """设置全局变量"""
     global_argument.set_value(self.public_ip)
     self.task_code = None
     self.relId = None
Example #2
0
 def __init__(self):
     self.logger = UserLogger.getlog()
     """当前服务器IP地址"""
     self.public_ip = BusinessUtil.get_public_ip()
     """设置全局变量"""
     global_argument.set_value(self.public_ip)
     """选择消费机制"""
     self.task_choice_pattern = self.public_ip
Example #3
0
    def __init__(self):
        """
		初始化
		"""
        self.logger = UserLogger.getlog()
        """当前服务器IP地址"""
        self.public_ip = BusinessUtil.get_public_ip()
        """设置全局变量"""
        global_argument.set_value(self.public_ip)
Example #4
0
        try:
            template_code = self.search_template_code(task_code)
            """未查到模板编码"""
            if not template_code:
                return False
            """查询redis"""
            template_redis_key = "%s_%s" % (template_code,
                                            busi_config.TEMPLATE_EXT_REDIS_KEY)
            result = BusinessUtil.get_redis_by_key(template_redis_key)
            if result:
                return result
            _db = MySqlHelper()
            result = _db.fetch_all(template_sql.search, template_code)
            """如果未查到值"""
            if not result:
                return False
            """redis入库"""
            BusinessUtil.set_redis_by_key(template_redis_key, result,
                                          busi_config.REDIS_CACHE_TIME)
            return result
        except Exception as e:
            self.logger.error("【查询有效服务器】查询异常信息为:%s" % traceback.format_exc())
        return False


if __name__ == '__main__':
    from base import global_argument

    global_argument.set_value("106.12.219.104")
    print(TemplateService().search('201905241427196394251011058'))