当前位置: 首页>>代码示例>>Python>>正文


Python RunManager.update_environment_variables方法代码示例

本文整理汇总了Python中opus_core.services.run_server.run_manager.RunManager.update_environment_variables方法的典型用法代码示例。如果您正苦于以下问题:Python RunManager.update_environment_variables方法的具体用法?Python RunManager.update_environment_variables怎么用?Python RunManager.update_environment_variables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opus_core.services.run_server.run_manager.RunManager的用法示例。


在下文中一共展示了RunManager.update_environment_variables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_restart_simple_run

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import update_environment_variables [as 别名]
    def test_restart_simple_run(self):
        _do_run_simple_test_run(self, self.temp_dir, self.config, end_year=1983)
        runs_manager = RunManager(self.config)
        config = _get_run_config(temp_dir=self.temp_dir)
        runs_manager.update_environment_variables(run_resources=config)

        run_activity = runs_manager.services_db.get_table("run_activity")
        s = select([func.max(run_activity.c.run_id)])
        run_id = runs_manager.services_db.execute(s).fetchone()[0]

        s = select([run_activity.c.status], whereclause=run_activity.c.run_id == run_id)
        status = runs_manager.services_db.execute(s).fetchone()[0]

        expected = "done"
        self.assertEqual(status, expected)

        runs_manager.restart_run(run_id, restart_year=1981, project_name="eugene_gridcell", skip_urbansim=False)

        s = select([run_activity.c.status], whereclause=run_activity.c.run_id == run_id)
        status = runs_manager.services_db.execute(s).fetchone()[0]

        expected = "done"
        self.assertEqual(status, expected)

        # Restaring without running urbansim should not re-run that year.
        # TODO: test that no models are run this time.
        runs_manager.restart_run(run_id, restart_year=1982, project_name="eugene_gridcell", skip_urbansim=True)
        s = select([run_activity.c.status], whereclause=run_activity.c.run_id == run_id)
        status = runs_manager.services_db.execute(s).fetchone()[0]

        expected = "done"
        self.assertEqual(status, expected)

        self.cleanup_test_run()
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:36,代码来源:test_run_manager.py

示例2: test_restart_simple_run

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import update_environment_variables [as 别名]
 def test_restart_simple_run(self):
     _do_run_simple_test_run(self, self.temp_dir, self.config)
     runs_manager = RunManager(self.config)
     runs_manager.update_environment_variables(run_resources = SubsetConfiguration())
     
     run_activity = runs_manager.services_db.get_table('run_activity')
     s = select([func.max(run_activity.c.run_id)])
     run_id = runs_manager.services_db.execute(s).fetchone()[0]
     
     s = select([run_activity.c.status],
                whereclause = run_activity.c.run_id == run_id)
     status = runs_manager.services_db.execute(s).fetchone()[0]
                                                                
     expected = 'done'
     self.assertEqual(status, expected)
                     
     runs_manager.restart_run(run_id,
                              restart_year=2001,
                              project_name = SubsetConfiguration()['project_name'],
                              skip_urbansim=False)
     
     s = select([run_activity.c.status],
                whereclause = run_activity.c.run_id == run_id)
     status = runs_manager.services_db.execute(s).fetchone()[0]
                                                    
     expected = 'done'
     self.assertEqual(status, expected)
        
     # Restaring without running urbansim should not re-run that year.
     # TODO: test that no models are run this time.
     runs_manager.restart_run(run_id,
                              restart_year=2002,
                              project_name = SubsetConfiguration()['project_name'],
                              skip_urbansim=True)
     s = select([run_activity.c.status],
                whereclause = run_activity.c.run_id == run_id)
     status = runs_manager.services_db.execute(s).fetchone()[0]
                                                                
     expected = 'done'
     self.assertEqual(status, expected)
                 
     self.cleanup_test_run()
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:44,代码来源:test_run_manager.py

示例3: OptionGroup

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import update_environment_variables [as 别名]
class OptionGroup(GenericOptionGroup):
    def __init__(self):
        GenericOptionGroup.__init__(self, usage="python %prog [options] run_id [pickle_file]",
               description="dump resources.pickle from services db for the given run_id")
        self.parser.add_option("-p", "--project-name", dest="project_name", 
                                default='',help="The project name")
                                
if __name__ == "__main__":
    option_group = OptionGroup()
    parser = option_group.parser
    (options, args) = parser.parse_args()

    try:
        run_id = int(args[0])
    except IndexError:
        parser.error("run_id must be provided.")
        parser.print_help()
        sys.exit(1)
    if len(args) == 2: 
        pickle_file = args[1]
    else:
        pickle_file = "resources.pickle"

    run_manager = RunManager(option_group.get_services_database_configuration(options))
    if options.project_name:
        run_manager.update_environment_variables(run_resources={'project_name':options.project_name}) 

    resources = run_manager.get_resources_for_run_id_from_history(run_id=run_id)
    write_resources_to_file(pickle_file, resources)
                                 
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:31,代码来源:dump_resources_from_services_db.py


注:本文中的opus_core.services.run_server.run_manager.RunManager.update_environment_variables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。