本文整理汇总了Python中opus_core.store.attribute_cache.AttributeCache.delete_computed_tables方法的典型用法代码示例。如果您正苦于以下问题:Python AttributeCache.delete_computed_tables方法的具体用法?Python AttributeCache.delete_computed_tables怎么用?Python AttributeCache.delete_computed_tables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opus_core.store.attribute_cache.AttributeCache
的用法示例。
在下文中一共展示了AttributeCache.delete_computed_tables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MergeCache
# 需要导入模块: from opus_core.store.attribute_cache import AttributeCache [as 别名]
# 或者: from opus_core.store.attribute_cache.AttributeCache import delete_computed_tables [as 别名]
class MergeCache(Model):
"""Merge multiple years of one cache directory into a single one that can be used
for example for a warm start."""
def __init__(self, directory):
self.storage = AttributeCache(directory)
def run(self, year, cleanup_settings={}):
SimulationState().set_current_time(year)
tables = self.storage.get_table_names()
# cleanup
for table in tables:
tabdata = self.storage.load_table(table)
if table in cleanup_settings.keys():
for attr in cleanup_settings[table]:
if attr in tabdata.keys():
logger.log_status('Deleting attribute %s in %s.' % (attr, table))
del tabdata[attr]
self.storage.write_table(table, tabdata)
logger.log_status('Deleting all computed tables.')
self.storage.delete_computed_tables()
logger.log_status('Cache directory merged into %s' % year)