本文整理汇总了Python中opus_core.session_configuration.SessionConfiguration.flush_loaded_datasets方法的典型用法代码示例。如果您正苦于以下问题:Python SessionConfiguration.flush_loaded_datasets方法的具体用法?Python SessionConfiguration.flush_loaded_datasets怎么用?Python SessionConfiguration.flush_loaded_datasets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opus_core.session_configuration.SessionConfiguration
的用法示例。
在下文中一共展示了SessionConfiguration.flush_loaded_datasets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from opus_core.session_configuration import SessionConfiguration [as 别名]
# 或者: from opus_core.session_configuration.SessionConfiguration import flush_loaded_datasets [as 别名]
if refinements is None:
refinements = dataset_pool.get_dataset('refinement')
years = refinements.get_attribute('year')
if start_year is None: start_year = years.min()
if end_year is None: end_year = years.max()
for year in range(start_year, end_year+1):
logger.start_block("Doing refinement for %s" % year )
simulation_state.set_current_time(year)
## reload refinements, from original refinement_directory or dataset_pool, in case it's been changed by refinement model
if refinements_storage is not None:
refinements = DatasetFactory().search_for_dataset('refinement', package_order, arguments={'in_storage':refinements_storage})
else:
refinements = dataset_pool.get_dataset('refinement')
if options.backup:
src_dir = os.path.join(options.cache_directory, str(year))
dst_dir = os.path.join(options.cache_directory, 'backup', str(year))
if os.path.exists(src_dir):
logger.log_status("Backing up %s to %s" % (src_dir, dst_dir))
copytree(src_dir, dst_dir)
RefinementModel().run(refinements, current_year=year, dataset_pool=dataset_pool)
if dataset_pool.has_dataset('refinement'):
#avoid caching refinements
dataset_pool._remove_dataset('refinement')
dataset_pool.flush_loaded_datasets()
dataset_pool.remove_all_datasets()
logger.end_block()