Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Fix - Misleading conflict error message on production version (#649)
Browse files Browse the repository at this point in the history
* fix: improve error message when old production version is conflicted with the current Configuration

* fix: allow the application to run when there are conflicted changes in old production version with --taipy-force

* update version.json to 2.3.1
  • Loading branch information
trgiangdo authored Jun 23, 2023
1 parent ce999cb commit 74febf9
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/taipy/core/_version/_version_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ def _get_or_create(cls, id: str, force: bool) -> _Version:
comparator_result = Config._comparator._find_conflict_config(version.config, Config._applied_config, id)
if comparator_result.get(_ComparatorResult.CONFLICTED_SECTION_KEY):
if force:
_TaipyLogger._get_logger().warning(f"Overriding version {id} ...")
cls.__logger.warning(
f"Option --taipy-force is detected, overriding the configuration of version {id} ..."
)
version.config = Config._applied_config
else:
raise SystemExit("The application is stopped. Please check the error log for more information.")
cls.__logger.error(
"To force running the application with the changes, run your application with --taipy-force option."
)
raise SystemExit()
else:
version = _Version(id=id, config=Config._applied_config)

Expand Down Expand Up @@ -132,7 +137,16 @@ def _set_production_version(cls, version_number: str, force: bool = False) -> st
version.config, Config._applied_config, production_version
)
if comparator_result.get(_ComparatorResult.CONFLICTED_SECTION_KEY):
raise SystemExit("The application is stopped. Please check the error log for more information.")
if force:
cls.__logger.warning(
f"Option --taipy-force is detected, the conflicted changes"
f" compared to version {version.id} are ignored."
)
else:
cls.__logger.error(
"To force running the application with the changes, run your application with --taipy-force option."
)
raise SystemExit()

else:
raise NonExistingVersion(production_version)
Expand Down Expand Up @@ -170,7 +184,7 @@ def _replace_version_number(cls, version_number: Optional[str]):
return cls._get_latest_version()
if version_number in cls.__DEVELOPMENT_VERSION:
return cls._get_development_version()
if version_number in cls.__PRODUCTION_VERSION:
if version_number == cls.__PRODUCTION_VERSION:
return cls._get_production_versions()
if version_number in cls.__ALL_VERSION:
return ""
Expand Down

0 comments on commit 74febf9

Please sign in to comment.