本文整理汇总了Python中opus_core.services.run_server.run_manager.RunManager.get_run_info方法的典型用法代码示例。如果您正苦于以下问题:Python RunManager.get_run_info方法的具体用法?Python RunManager.get_run_info怎么用?Python RunManager.get_run_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opus_core.services.run_server.run_manager.RunManager
的用法示例。
在下文中一共展示了RunManager.get_run_info方法的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_run_info [as 别名]
#.........这里部分代码省略.........
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:
raise TypeError, "Unrecongized data type in calib_datasets"
# dtype = dataset[calib_attr].dtype
# dataset[calib_attr][index] = (est_v[i_est_v:i_est_v+index.size]).astype(dtype)
# flush dataset
dataset.flush_dataset()
# i_est_v += index.size
simulation_state.set_current_time(current_year)
def update_prediction(self, est_v, simulation_state, dataset_pool, calib_datasets, *args, **kwargs):
option_group = RestartRunOptionGroup()
option_group.parser.set_defaults(project_name=self.project_name, skip_cache_cleanup=self.skip_cache_cleanup)
options, args = option_group.parse()
if self.run_manager is None:
self.run_manager = RunManager(option_group.get_services_database_configuration(options))
if lock != None:
lock.acquire()
## query runs available for re-use
runs_done = self.run_manager.get_run_info(run_ids=self.run_ids, status="done")
create_baseyear_cache = False
import pdb
pdb.set_trace()
if len(runs_done) == 0: ##there is no re-usable run directory, init a new run
run_id, cache_directory = self.init_run(create_baseyear_cache=False)
self.run_ids.append(run_id)
create_baseyear_cache = True
logger.log_status("Initializing new run with id " + str(run_id))
else:
run_id = runs_done[0].run_id ##take the first 'done' run_id
cache_directory = self.run_manager.get_cache_directory(run_id)
logger.log_status("Using old run with id " + str(run_id))
resources = self.run_manager.get_resources_for_run_id_from_history(run_id, filter_by_status=False)
self.run_manager.add_row_to_history(run_id, resources, "taken")
if lock != None:
lock.release()
if create_baseyear_cache:
self.run_manager.create_baseyear_cache(resources)
self.update_parameters(est_v, cache_directory, simulation_state, dataset_pool, calib_datasets, *args, **kwargs)
restart_run(option_group=option_group, args=[run_id, self.start_year])
prediction = self.summarize_prediction(cache_directory, simulation_state, dataset_pool, calib_datasets)
return prediction
def summarize_prediction(self, cache_directory, simulation_state, dataset_pool, calib_datasets):
dataset_name = VariableName(self.target_expression).get_dataset_name()
current_year = simulation_state.get_current_time()
simulation_state.set_current_time(self.end_year)
simulation_state.set_cache_directory(cache_directory)