本文整理汇总了Python中opus_core.services.run_server.run_manager.RunManager.get_current_cache_directory方法的典型用法代码示例。如果您正苦于以下问题:Python RunManager.get_current_cache_directory方法的具体用法?Python RunManager.get_current_cache_directory怎么用?Python RunManager.get_current_cache_directory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opus_core.services.run_server.run_manager.RunManager
的用法示例。
在下文中一共展示了RunManager.get_current_cache_directory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Calibration
# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import get_current_cache_directory [as 别名]
#.........这里部分代码省略.........
raise ValueError, "Unrecognized optimizer {}".format(optimizer)
default_kwargs.update(optimizer_kwargs)
results = optimizer_func(self.target_func, copy(init_v), **default_kwargs)
duration = time.time() - t0
if results_pickle_prefix is not None:
pickle_file = "{}_{}.pickle".format(results_pickle_prefix, optimizer)
pickle_file = os.path.join(self.log_directory, pickle_file)
pickle.dump(results, open(pickle_file, "wb"))
if is_parallelizable == True:
set_parallel(False)
logger.log_status("init target_func: {}".format(self.target_func(init_v)))
logger.log_status("end target_func: {}".format(results[:])) # which one?
logger.log_status("outputs from optimizer: {}".format(results))
logger.log_status("Execution time: {}".format(duration))
def init_run(self, create_baseyear_cache=True):
""" init run, get run_id & cache_directory. """
##avoid invoking start_run from cmd line -
option_group = StartRunOptionGroup()
option_group.parser.set_defaults(xml_configuration=self.xml_config, scenario_name=self.scenario)
# run_id, cache_directory = start_run(option_group)
options, args = option_group.parse()
self.run_manager = RunManager(option_group.get_services_database_configuration(options))
resources = XMLConfiguration(self.xml_config).get_run_configuration(self.scenario)
insert_auto_generated_cache_directory_if_needed(resources)
cache_directory = resources["cache_directory"]
self.run_manager.setup_new_run(cache_directory, resources)
run_id, cache_directory = self.run_manager.run_id, self.run_manager.get_current_cache_directory()
self.run_manager.add_row_to_history(run_id, resources, "done")
if create_baseyear_cache:
self.run_manager.create_baseyear_cache(resources)
## good for testing
# run_id = 275
# cache_directory = '/home/lmwang/opus/data/paris_zone/runs/run_275.2012_05_26_00_20'
assert run_id is not None
assert cache_directory is not None
return run_id, cache_directory
def update_parameters(
self, est_v, cache_directory, simulation_state, dataset_pool, calib_datasets, *args, **kwargs
):
i_est_v = 0
current_year = simulation_state.get_current_time()
simulation_state.set_current_time(self.base_year)
simulation_state.set_cache_directory(cache_directory)
for dataset_name, calib in calib_datasets.iteritems():
dataset, calib_attr, index = calib
if type(calib_attr) == str:
dtype = dataset[calib_attr].dtype
dataset[calib_attr][index] = (est_v[i_est_v : i_est_v + index.size]).astype(dtype)
i_est_v += index.size
elif type(calib_attr) in (list, tuple):
for attr in calib_attr:
dtype = dataset[attr].dtype
dataset[attr][index] = (est_v[i_est_v : i_est_v + index.size]).astype(dtype)
i_est_v += index.size
else: