本文整理汇总了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)
示例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")