本文整理匯總了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)