def take_action(self, parsed_args): # type: (Namespace) -> None if self.app_args.storage is None and self.app_args.config is None: raise CLIUsageError( "Either --storage or --config option is required.") config = optuna.config.load_optuna_config(self.app_args.config) storage_url = get_storage_url(self.app_args.storage, config) storage = RDBStorage(storage_url, skip_compatibility_check=True) current_version = storage.get_current_version() head_version = storage.get_head_version() known_versions = storage.get_all_versions() if current_version == head_version: self.logger.info('This storage is up-to-date.') elif current_version in known_versions: self.logger.info( 'Upgrading the storage schema to the latest version.') storage.upgrade() self.logger.info("Completed to upgrade the storage.") else: self.logger.warning( 'Your optuna version seems outdated against the storage version. ' 'Please try updating optuna to the latest version by ' '`$ pip install -U optuna`.')
def take_action(self, parsed_args): # type: (Namespace) -> None storage_url = _check_storage_url(self.app_args.storage) storage = RDBStorage(storage_url, skip_compatibility_check=True) current_version = storage.get_current_version() head_version = storage.get_head_version() known_versions = storage.get_all_versions() if current_version == head_version: self.logger.info('This storage is up-to-date.') elif current_version in known_versions: self.logger.info('Upgrading the storage schema to the latest version.') storage.upgrade() self.logger.info("Completed to upgrade the storage.") else: self.logger.warning('Your optuna version seems outdated against the storage version. ' 'Please try updating optuna to the latest version by ' '`$ pip install -U optuna`.')
def take_action(self, parsed_args: Namespace) -> None: storage_url = _check_storage_url(self.app_args.storage) if storage_url.startswith("redis"): self.logger.info("This storage does not support upgrade yet.") return storage = RDBStorage(storage_url, skip_compatibility_check=True) current_version = storage.get_current_version() head_version = storage.get_head_version() known_versions = storage.get_all_versions() if current_version == head_version: self.logger.info("This storage is up-to-date.") elif current_version in known_versions: self.logger.info( "Upgrading the storage schema to the latest version.") storage.upgrade() self.logger.info("Completed to upgrade the storage.") else: warnings.warn( "Your optuna version seems outdated against the storage version. " "Please try updating optuna to the latest version by " "`$ pip install -U optuna`.")