當前位置: 首頁>>代碼示例>>Python>>正文


Python LogFactory.warn方法代碼示例

本文整理匯總了Python中modules.util.log.LogFactory.warn方法的典型用法代碼示例。如果您正苦於以下問題:Python LogFactory.warn方法的具體用法?Python LogFactory.warn怎麽用?Python LogFactory.warn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在modules.util.log.LogFactory的用法示例。


在下文中一共展示了LogFactory.warn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: export_env_var

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import warn [as 別名]
 def export_env_var(self, variable, value):
     log = LogFactory().get_log(__name__)
     if value is not None:
         os.environ[variable] = value
         log.info("Exported environment variable %s: %s" % (variable, value))
     else:
         log.warn("Could not export environment variable %s " % variable)
開發者ID:lasinducharith,項目名稱:product-private-paas,代碼行數:9,代碼來源:wso2esb-startup-handler.py

示例2: run_plugin

# 需要導入模塊: from modules.util.log import LogFactory [as 別名]
# 或者: from modules.util.log.LogFactory import warn [as 別名]

#.........這裏部分代碼省略.........
            if local_ip is not None:
                local_ip = local_ip[0:-1]
                command = "sed -i \"s/^CONFIG_PARAM_LOCAL_MEMBER_HOST=.*/CONFIG_PARAM_LOCAL_MEMBER_HOST=%s/g\" %s" % (
                local_ip, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
                p = subprocess.Popen(command, shell=True)
                output, errors = p.communicate()
                log.info("Successfully updated local member ip: %s in WSO2 CEP template module" % local_ip)

            # Set CONFIG_PARAM_MANAGER=true
            command = "sed -i \"s/^CONFIG_PARAM_MANAGER=.*/CONFIG_PARAM_MANAGER=%s/g\" %s" % (
            is_cep_mgr, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated config parameter manager: %s in WSO2 CEP template module" % is_cep_mgr)

        # Read all CEP Manager private IPs and update CONFIG_PARAM_MANAGER_MEMBERS in module.ini
        cep_mgr_private_ip_list = []
        if topology_json is not None:
            # add service map
            for service_name in topology_json["serviceMap"]:
                service_str = topology_json["serviceMap"][service_name]
                if service_name == "cep-mgr":
                    # add cluster map
                    for cluster_id in service_str["clusterIdClusterMap"]:
                        cluster_str = service_str["clusterIdClusterMap"][cluster_id]
                        if cluster_str["appId"] == app_id:
                            # add member map
                            for member_id in cluster_str["memberMap"]:
                                member_str = cluster_str["memberMap"][member_id]
                                if member_str["defaultPrivateIP"] is not None:
                                    cep_mgr_private_ip_list.append(member_str["defaultPrivateIP"])

        if cep_mgr_private_ip_list:
            managers_string = '['
            for member_ip in cep_mgr_private_ip_list:
                if member_ip is not cep_mgr_private_ip_list[-1]:
                    managers_string += member_ip + ':8904' + ','
                else:
                    managers_string += member_ip + ':8904'
            managers_string += ']'

            command = "sed -i \"s/^CONFIG_PARAM_MANAGER_MEMBERS=.*/CONFIG_PARAM_MANAGER_MEMBERS=%s/g\" %s" % (
            managers_string, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated CEP Managers list: %s in WSO2 CEP template module" % managers_string)
        else:
            # If no manager IPs are found comment-out CONFIG_PARAM_MANAGER_MEMBERS property
            command = "sed -i \"s/^CONFIG_PARAM_MANAGER_MEMBERS=.*/#CONFIG_PARAM_MANAGER_MEMBERS=/g\" %s" % "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini"
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.warn(
                "CEP Manager IPs are not found in topology, hence removing CONFIG_PARAM_MANAGER_MEMBERS property from module.ini")

        # Read all CEP Manager/Worker cluster-ids from topology and update CONFIG_PARAM_CLUSTER_IDs in module.ini
        cep_worker_manager_cluster_ids = []
        if topology_json is not None:
            # add service map
            for service_name in topology_json["serviceMap"]:
                service_str = topology_json["serviceMap"][service_name]
                # Check for both CEP-Mgr and CEP-Wkr clusters
                if service_name == "cep-mgr" or service_name == "cep-wkr":
                    # add cluster map
                    for cluster_id in service_str["clusterIdClusterMap"]:
                        cluster_str = service_str["clusterIdClusterMap"][cluster_id]
                        if cluster_str["appId"] == app_id:
                            # Append cep worker/manager cluster id
                            cep_worker_manager_cluster_ids.append(cluster_str["clusterId"])

        if cep_worker_manager_cluster_ids:
            cep_clusterIds = ",".join(cep_worker_manager_cluster_ids)

            command = "sed -i \"s/^CONFIG_PARAM_CLUSTER_IDs=.*/CONFIG_PARAM_CLUSTER_IDs=%s/g\" %s" % (
                cep_clusterIds, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated cep cluster_ids: %s in WSO2 CEP template module" % cep_clusterIds)
        else:
            # If no cluster_ids are found in topology, comment-out CONFIG_PARAM_CLUSTER_IDs property from module.ini
            command = "sed -i \"s/^CONFIG_PARAM_CLUSTER_IDs=.*/#CONFIG_PARAM_CLUSTER_IDs=/g\" %s" % "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini"
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.warn("CEP Manager/Worker cluster ids are not found in topology, hence removing CONFIG_PARAM_CLUSTER_IDs"
                     " property from module.ini")

        # Update MB_IP in module.ini to be used by jndi.properties
        if mb_ip is not None:
            command = "sed -i \"s/^CONFIG_PARAM_MB_HOST=.*/CONFIG_PARAM_MB_HOST=%s/g\" %s" % (
                mb_ip, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
            p = subprocess.Popen(command, shell=True)
            output, errors = p.communicate()
            log.info("Successfully updated mb ip: %s in WSO2 CEP template module" % mb_ip)

        # configure server
        log.info("Configuring WSO2 CEP ...")
        config_command = "python /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
        env_var = os.environ.copy()
        p = subprocess.Popen(config_command, env=env_var, shell=True)
        output, errors = p.communicate()
        log.info("WSO2 CEP configured successfully")
開發者ID:gayangunarathne,項目名稱:wso2privatepaas,代碼行數:104,代碼來源:wso2cep-topology-handler.py


注:本文中的modules.util.log.LogFactory.warn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。