本文整理汇总了Python中configuration.Configuration.write_filterchain方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.write_filterchain方法的具体用法?Python Configuration.write_filterchain怎么用?Python Configuration.write_filterchain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.write_filterchain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import write_filterchain [as 别名]
#.........这里部分代码省略.........
def reload_filter(self, filter_name=None):
o_filter = self.resource.reload_filter(filter_name)
if o_filter is None:
return False
for execution in self.dct_exec.values():
filterchain = execution.get(KEY_FILTERCHAIN, None)
if filterchain:
filterchain.reload_filter(o_filter)
return True
def get_params_filterchain(self, execution_name, filter_name):
# get actual filter from execution
# TODO search information from configuration if execution not exist
if not execution_name:
return None
filterchain = self._get_filterchain(execution_name)
if not filterchain:
return None
return filterchain.get_params(filter_name=filter_name)
def get_filterchain_info(self, filterchain_name):
return self.resource.get_filterchain_info(filterchain_name)
def update_param(self, execution_name, filter_name, param_name, value):
filterchain = self._get_filterchain(execution_name)
if not filterchain:
return False
o_filter = filterchain.get_filter(name=filter_name)
if not o_filter:
log.print_function(logger.error, "Don't find filter %s on filterchain %s" % (filter_name, filterchain.get_name()))
return False
param = o_filter.get_params(param_name=param_name)
if not param:
log.print_function(logger.error, "Don't find param %s on filter %s" % (param_name, filter_name))
return False
param.set(value)
o_filter.configure()
return True
def save_params(self, execution_name):
"Force serialization and overwrite config"
filterchain = self._get_filterchain(execution_name)
if not filterchain:
return False
return self.config.write_filterchain(filterchain)
def get_filterchain_list(self):
return self.resource.get_filterchain_list()
def upload_filterchain(self, filterchain_name, s_file_contain):
return self.resource.upload_filterchain(filterchain_name, s_file_contain)
def delete_filterchain(self, filterchain_name):
return self.resource.delete_filterchain(filterchain_name)
def modify_filterchain(self, old_filterchain_name, new_filterchain_name, lst_str_filters, default_media):
return self.resource.modify_filterchain(old_filterchain_name, new_filterchain_name, lst_str_filters, default_media)
##########################################################################
############################### FILTER ##################################
##########################################################################
def get_filter_list(self):
return self.resource.get_filter_info_list()
##########################################################################
############################## PRIVATE ##################################
##########################################################################
def _get_execution(self, execution_name):
dct_execution = self.dct_exec.get(execution_name, {})
if not dct_execution:
msg = "Don't find execution %s. List execution name: %s" % (execution_name, self.dct_exec.keys())
log.print_function(logger.warning, msg, last_stack=True)
return None
return dct_execution
def _get_filterchain(self, execution_name):
dct_execution = self._get_execution(execution_name)
if dct_execution is None:
return None
filterchain = dct_execution.get(KEY_FILTERCHAIN, None)
if not filterchain:
msg = "Execution %s hasn't filterchain." % execution_name
log.print_function(logger.critical, msg, last_stack=True)
return None
return filterchain
def _get_media(self, media_name=None, execution_name=None):
media = None
if media_name:
media = self.resource.get_media(media_name)
if not media:
log.print_function(logger.error, "Cannot found the media %s." % media_name, last_stack=True)
return None
elif execution_name:
dct_execution = self._get_execution(execution_name)
if not dct_execution:
return None
media = dct_execution.get(KEY_MEDIA, None)
return media
示例2: __init__
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import write_filterchain [as 别名]
#.........这里部分代码省略.........
param_name)
if not lst_param:
return False
for param in lst_param:
param.reset()
# TODO update when filter is not running
o_filter = self._get_filter(execution_name, filter_name)
o_filter.configure()
return True
def set_as_default_param(self, execution_name, filter_name, param_name):
self._post_command_(locals())
lst_param = self._get_lst_param_filter(execution_name,
filter_name,
param_name)
if not lst_param:
return False
for param in lst_param:
param.set_as_default()
# TODO update when filter is not running
o_filter = self._get_filter(execution_name, filter_name)
o_filter.configure()
return True
def save_params(self, execution_name):
"""Force serialization and overwrite config"""
self._post_command_(locals())
filterchain = self._get_filterchain(execution_name)
if not filterchain:
return False
return self.config.write_filterchain(filterchain)
def get_filterchain_list(self):
self._post_command_(locals())
return self.resource.get_filterchain_list()
def upload_filterchain(self, filterchain_name, s_file_contain):
self._post_command_(locals())
return self.resource.upload_filterchain(filterchain_name,
s_file_contain)
def delete_filterchain(self, filterchain_name):
self._post_command_(locals())
return self.resource.delete_filterchain(filterchain_name)
def modify_filterchain(self, old_filterchain_name,
new_filterchain_name, lst_str_filters,
default_media):
self._post_command_(locals())
return self.resource.modify_filterchain(old_filterchain_name,
new_filterchain_name,
lst_str_filters,
default_media)
#
# FILTER ##################################
#
def get_filter_list(self):
self._post_command_(locals())
return self.resource.get_filter_info_list()
#
# PRIVATE ##################################