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


Python RunManager.restart_run方法代码示例

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


在下文中一共展示了RunManager.restart_run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 restart_run [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: main

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import restart_run [as 别名]
def main(option_group=None, args=None):
    if option_group is None:
        option_group = RestartRunOptionGroup()
    parser = option_group.parser
    if args is None:
        options, args = option_group.parse()
    else: 
        options, _args = option_group.parse()
    run_manager = RunManager(option_group.get_services_database_configuration(options))
    run_as_multiprocess = not options.run_as_single_process
    
    if len(args) < 2:
        parser.print_help()
    else:
        run_id, year = (int(args[0]), int(args[1]))
        end_year = int(options.end_year) if options.end_year is not None else None
        run_manager.restart_run(run_id, 
                                year,
                                options.project_name,
                                end_year=end_year,
                                skip_urbansim=options.skip_urbansim,
                                create_baseyear_cache_if_not_exists=options.create_baseyear_cache_if_not_exists,
                                skip_cache_cleanup=options.skip_cache_cleanup,
                                run_as_multiprocess=run_as_multiprocess
                                )
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:27,代码来源:restart_run.py

示例3: main

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import restart_run [as 别名]
def main(option_group=None, args=None):

    if option_group is None:
        option_group = restart_run.RestartRunOptionGroup()
    parser = option_group.parser
    if args is None:
        options, args = option_group.parse()
    else: 
        options, _args = option_group.parse()
    run_manager = RunManager(option_group.get_services_database_configuration(options))
    run_as_multiprocess = not options.run_as_single_process

    if len(args) < 1:
        parser.print_help()
        sys.exit(1)
    run_id = int(args[0])
    year = None
    if len(args) > 1:
        year = int(args[1])

    # Get configuration from DB and ensure the run directory is mounted.  Note
    # that we pass a dummy value for restart_year because we might not know it
    # yet.  But when we actually restart the run, we will pass the correct
    # year.
    run_resources = run_manager.create_run_resources_from_history(run_id=run_id,
                                                                  restart_year=2010)
    hudson_common.mount_cache_dir(run_resources)

    cache_dir = run_resources['cache_directory']
    if not year:
        # guess the year based on how the cache dir is populated
        years = map(lambda y : int(os.path.basename(y)),
                    glob.glob(os.path.join(cache_dir, "2*")))
        year = max(years)

    end_year = int(options.end_year) if options.end_year is not None else None
    run_manager.restart_run(run_id, 
                            year,
                            options.project_name,
                            end_year=end_year,
                            skip_urbansim=options.skip_urbansim,
                            create_baseyear_cache_if_not_exists=options.create_baseyear_cache_if_not_exists,
                            skip_cache_cleanup=options.skip_cache_cleanup,
                            run_as_multiprocess=run_as_multiprocess
                            )
开发者ID:,项目名称:,代码行数:47,代码来源:

示例4: 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 restart_run [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

示例5: RestartRunOptionGroup

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import restart_run [as 别名]
        self.parser.add_option("-p", "--project-name", dest="project_name", 
                                default='',help="The name project name")
        self.parser.add_option("--skip-urbansim", dest="skip_urbansim", default=False, 
                                action="store_true", 
                                help="Skip running UrbanSim for the restart year.")
        self.parser.add_option("--create-baseyear-cache-if-not-exists", dest="create_baseyear_cache_if_not_exists", default=False, 
                                action="store_true",
                                help="Create baseyear cache if not already exists")
        self.parser.add_option("--skip-cache-cleanup", dest="skip_cache_cleanup", 
                                default=False, action="store_true", 
                                help="Skip removing year caches for this and future years.")
                                
if __name__ == "__main__":
    option_group = RestartRunOptionGroup()
    parser = option_group.parser
    (options, args) = parser.parse_args()

    run_manager = RunManager(option_group.get_services_database_configuration(options))

    if len(args) < 2:
        parser.print_help()
    else:
        run_id, year = (int(args[0]), int(args[1]))
        run_manager.restart_run(run_id, 
                                year,
                                options.project_name,
                                skip_urbansim=options.skip_urbansim,
                                create_baseyear_cache_if_not_exists=options.create_baseyear_cache_if_not_exists,
                                skip_cache_cleanup=options.skip_cache_cleanup)
                                  
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:31,代码来源:restart_run.py


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