def get_run_manager(self): """in case the connection to services timeout, reconnect """ try: self._run_manager.services_db.table_exists('run_activity') except: #connection has gone away, re-create run_manager self._run_manager = RunManager( self.services_db_config) return self._run_manager
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("--skip-travel-model", dest="skip_travel_model", default=False, action="store_true", help="Skip running travel model for the any year.") 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.") self.parser.add_option("--project-name", dest="project_name", default='misc', action="store", help="The name of the project that the restarted run is part of (e.g. eugene_gridcell)") 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, project_name = options.project_name, skip_urbansim=options.skip_urbansim, skip_travel_model=options.skip_travel_model, skip_cache_cleanup=options.skip_cache_cleanup)
default_hostname = "128.208.52.233" remote_cache_directory_root = '/urbansim_cache/psrc_parcel/' #the ending slash is critical ################################################# hostname = raw_input('Hostname [%s]: ' % default_hostname) if len(hostname) == 0: hostname = default_hostname username = raw_input('Username [%s]: ' % default_username) if len(username) == 0: username = default_username password = getpass.getpass('Password for %s@%s: ' % (username, hostname)) #this line will be executed in shell and return the absolute path for restart_run.py restart_run_py = r"`python -c \"from opus_core.misc import module_path_from_opus_path; print module_path_from_opus_path('urbansim.tools.restart_run')\"`" run_manager = RunManager(option_group.get_services_database_configuration(options)) if options.run_id is not None: run_id = options.run_id else: # if options.pickled_resource_file is not None: # f = file(options.pickled_resource_file, 'r') # try: # config = pickle.load(f) # finally: # f.close() # elif options.configuration_path is not None: opus_path = options.configuration_path # try: config = get_config_from_opus_path(opus_path) config['creating_baseyear_cache_configuration'].cache_directory_root = local_cache_directory_root