Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix v2.15.6 to master #1832

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions antarest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

# Standard project metadata

__version__ = "2.15.5"
__version__ = "2.15.6"
__author__ = "RTE, Antares Web Team"
__date__ = "2023-11-16"
__date__ = "2023-11-24"
# noinspection SpellCheckingInspection
__credits__ = "(c) Réseau de Transport de l’Électricité (RTE)"

Expand Down
17 changes: 11 additions & 6 deletions antarest/study/storage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def get_start_date(


def export_study_flat(
path_study: Path,
study_dir: Path,
dest: Path,
study_factory: StudyFactory,
outputs: bool = True,
Expand All @@ -362,11 +362,11 @@ def export_study_flat(
) -> None:
start_time = time.time()

output_src_path = output_src_path or path_study / "output"
output_src_path = output_src_path or study_dir / "output"
output_dest_path = dest / "output"
ignore_patterns = lambda directory, contents: ["output"] if str(directory) == str(path_study) else []
ignore_patterns = lambda directory, contents: ["output"] if str(directory) == str(study_dir) else []

shutil.copytree(src=path_study, dst=dest, ignore=ignore_patterns)
shutil.copytree(src=study_dir, dst=dest, ignore=ignore_patterns)

if outputs and output_src_path.exists():
if output_list_filter is None:
Expand All @@ -390,9 +390,14 @@ def export_study_flat(

stop_time = time.time()
duration = "{:.3f}".format(stop_time - start_time)
logger.info(f"Study {path_study} exported (flat mode) in {duration}s")
logger.info(
{
False: f"Study '{study_dir}' exported (flat mode) in {duration}s",
True: f"Study '{study_dir}' exported with outputs (flat mode) in {duration}s",
}[bool(outputs)]
)
study = study_factory.create_from_fs(dest, "", use_cache=False)
if denormalize:
study.tree.denormalize()
duration = "{:.3f}".format(time.time() - stop_time)
logger.info(f"Study {path_study} denormalized in {duration}s")
logger.info(f"Study '{study_dir}' denormalized in {duration}s")
2 changes: 2 additions & 0 deletions antarest/study/storage/variantstudy/snapshot_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ def _export_ref_study(self, ref_study: t.Union[RawStudy, VariantStudy]) -> None:
self._tmp_dir,
self.study_factory,
denormalize=False, # de-normalization is done at the end
outputs=False, # do NOT export outputs
)
elif isinstance(ref_study, RawStudy):
self.raw_study_service.export_study_flat(
ref_study,
self._tmp_dir,
denormalize=False, # de-normalization is done at the end
outputs=False, # do NOT export outputs
)
else: # pragma: no cover
raise TypeError(repr(type(ref_study)))
Expand Down
61 changes: 17 additions & 44 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,40 @@
Antares Web Changelog
=====================

v2.15.5 (2023-11-16)
v2.15.6 (2023-11-24)
--------------------

### Features

* **ui-common:** add clear button on SearchFE ([5623857](https://github.com/AntaresSimulatorTeam/AntaREST/commit/56238573ee15cf2bd46778ff3fcf9dd8c6d9563a))
* **ui-study:** translate generate button in command view (#1801) ([20a49c7](https://github.com/AntaresSimulatorTeam/AntaREST/commit/20a49c77d0713746fda27c043dacd6f117b76f12))
* **launcher:** add information about which user launched a study (#1808) ([ac8d29b](https://github.com/AntaresSimulatorTeam/AntaREST/commit/ac8d29be1d4f714451cbccb182cfce5741e910f5))
* **repository:** add a method to update a task status to TIMEOUT in database ([38addea](https://github.com/AntaresSimulatorTeam/AntaREST/commit/38addea8ceb246b77bd49793147bec4ebe6baa8e))
* **variant-generation:** improve error handling for timeout tasks ([979ac6a](https://github.com/AntaresSimulatorTeam/AntaREST/commit/979ac6a4e5cf1cd6c74ee7b5474c389c8cad510f))
* **tasks:** add timeout parameter to control task completion wait time ([0cac11c](https://github.com/AntaresSimulatorTeam/AntaREST/commit/0cac11c4233a80655323a7eabfb9cac62c22e1df))
* **variant-study-repo:** add the `get_ancestor_or_self_ids` to retrieve all ancestor IDs of a variant study ([8262e14](https://github.com/AntaresSimulatorTeam/AntaREST/commit/8262e14897dab55f9dad9bd0a21b289f9f481002))
* **permission:** add the `assert_permission_on_studies` to check user permission of several studies ([ea69c38](https://github.com/AntaresSimulatorTeam/AntaREST/commit/ea69c38574816999046faf0fda8122c559457470))
* **db:** add methods to check the variant study snapshot status ([e4f7756](https://github.com/AntaresSimulatorTeam/AntaREST/commit/e4f7756a871efe763bb559ba7524fb258aa5532f))
* **variant:** add the `SnapshotGenerator` class ([70595c9](https://github.com/AntaresSimulatorTeam/AntaREST/commit/70595c982f7b647815b3efe5a78938235d59c60d))
* **variant:** use the `SnapshotGenerator` class in the `VariantStudyService` ([be805dc](https://github.com/AntaresSimulatorTeam/AntaREST/commit/be805dc62da46cc49dd2cc52bad2ac75d59d9f89))


### Bug Fixes

* **tasks:** resolve incorrect UTC timezone usage for task completion dates in list view (#1786) ([1f23998](https://github.com/AntaresSimulatorTeam/AntaREST/commit/1f2399853d42050872b51c2f11c0a686a7edcdb8))
* **upgrade:** remove tmp files when upgrading (#1804) ([5538109](https://github.com/AntaresSimulatorTeam/AntaREST/commit/55381093e1b0a907baffb72b708b5612218969b9))
* **api-job-result:** correct the DELETE endpoint to return 204 No Content ([1d5b8df](https://github.com/AntaresSimulatorTeam/AntaREST/commit/1d5b8df91c0a8d205fb554318847dc8b7757cd73))
* **task-job-service:** update the task status to TIMEOUT if the processing is too long ([ff357bc](https://github.com/AntaresSimulatorTeam/AntaREST/commit/ff357bc6a862c5409ccf31deb0f478ebbb075388))


### Chore

* **typing:** simplify typing in pytest fixture ([da13c45](https://github.com/AntaresSimulatorTeam/AntaREST/commit/da13c45878f7904c82f105a15a5bbed6036b5f7e))
* **variant-study-service:** correct the `timeout` parameter to use a default value ([1e2e617](https://github.com/AntaresSimulatorTeam/AntaREST/commit/1e2e6176ba0943c7c53d31f3fbc8e950c50b6188))
* improve log message readability by adding prominent emojis ([eb87bb8](https://github.com/AntaresSimulatorTeam/AntaREST/commit/eb87bb8782a3eb5fca213a64da24bc64e916ed9d))
### Performance

* **variant:** correct slow variant study snapshot generation [`#1828`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1828)

### Code Refactoring

* **variant-study-service:** improve implementation of safe generation ([959b2c0](https://github.com/AntaresSimulatorTeam/AntaREST/commit/959b2c021c3e708f0f0b4d5e77e147ac3a71d7c5))
* **variant-study-repo:** optionally use a user-defined SqlAlchemy session instead of the global `db.session` and improve the documentation ([cd15eec](https://github.com/AntaresSimulatorTeam/AntaREST/commit/cd15eec62302844aed3e740cb3679f8f92da3846))
### Documentation

* **RTD:** correct the configuration for [ReadTheDocs](https://antares-web.readthedocs.io/en/latest/) [`#1833`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1833)

### Tests

* **variant-generation:** add a unit test to check that the variant generation is not blocking the main thread ([0ba6320](https://github.com/AntaresSimulatorTeam/AntaREST/commit/0ba63200d12032adbce7795b9da0ce033f87121b))
* **hydro:** improves testing of hydraulic allocation variants ([21823ba](https://github.com/AntaresSimulatorTeam/AntaREST/commit/21823bae235a8659aa1d2452df76b751ff4b0b05))
* **variant:** correct the `test_variant_model` unit test to use fixtures ([340881e](https://github.com/AntaresSimulatorTeam/AntaREST/commit/340881e629bfbdfa05ceb1761f0ebe98279c9044))
### Contributors

<a href="https://github.com/laurent-laporte-pro">laurent-laporte-pro</a>.

### Styles

* **db:** add type hints in database model classes ([4c9c081](https://github.com/AntaresSimulatorTeam/AntaREST/commit/4c9c081da03bde9ce3c1b202562d485099cb7f35))
* correct return type of the get task endpoint ([7dff31a](https://github.com/AntaresSimulatorTeam/AntaREST/commit/7dff31affa0bb1d2c07ae4336d4e16d55cfcba94))
* correct variable naming ([8d42c1b](https://github.com/AntaresSimulatorTeam/AntaREST/commit/8d42c1bd05b6cc1496f60f47eb11e5c99111c1f1))

v2.15.5 (2023-11-16)
--------------------

### Documentation
### Features

* **cache:** add the documentation of cache constants ([94d3cdb](https://github.com/AntaresSimulatorTeam/AntaREST/commit/94d3cdb15b1fe8e3b12612ba832eda6c07366525))
* Remove studies filters and search value from localStorage [`#1788`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1788)
* **ui-study:** translate generate button in command view [`#1801`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1801)
* **launcher:** add information about which user launched a study [`#1808`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1808)


### Performance Improvements
### Bug Fixes

* **db:** improved study query performance using owner and groups preloading ([16cf54f](https://github.com/AntaresSimulatorTeam/AntaREST/commit/16cf54ff8ef54ce1c7c735a45566ff9e35f96e53))
* **tasks:** resolve incorrect UTC timezone usage for task completion dates in list view [`#1786`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1786)
* **upgrade:** remove tmp files when upgrading [`#1804`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1804)
* **variant:** generates cascades of variants synchronously to avoid timeout dead locks [`#1806`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1806)


### Contributors
Expand Down
18 changes: 14 additions & 4 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Read the Docs configuration file for MkDocs projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

python:
version: 3.8
install:
- requirements: requirements-doc.txt
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: '3.8'

mkdocs:
configuration: mkdocs.yml

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: requirements-doc.txt
4 changes: 0 additions & 4 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
mkdocs
mkdocs-material

# Add the required dependencies for ReadTheDocs
sphinx
myst-parser
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="AntaREST",
version="2.15.5",
version="2.15.6",
description="Antares Server",
long_description=Path("README.md").read_text(encoding="utf-8"),
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ sonar.exclusions=antarest/gui.py,antarest/main.py
sonar.python.coverage.reportPaths=coverage.xml
sonar.python.version=3.8
sonar.javascript.lcov.reportPaths=webapp/coverage/lcov.info
sonar.projectVersion=2.15.5
sonar.projectVersion=2.15.6
sonar.coverage.exclusions=antarest/gui.py,antarest/main.py,antarest/singleton_services.py,antarest/worker/archive_worker_service.py,webapp/**/*
13 changes: 13 additions & 0 deletions tests/study/storage/variantstudy/test_snapshot_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,16 @@ def root_study_id_fixture(
additional_data=StudyAdditionalData(author="john.doe"),
owner_id=jwt_user.id,
)

# Create the study in database
root_study = raw_study_service.create(root_study)

# Create some outputs with a "simulation.log" file
for output_name in ["20230802-1425eco", "20230802-1628eco"]:
output_dir = study_dir / "output" / output_name
output_dir.mkdir(parents=True)
(output_dir / "simulation.log").touch()

with db():
# Save the root study in database
variant_study_service.repository.save(root_study)
Expand Down Expand Up @@ -695,6 +704,7 @@ def test_generate__nominal_case(
- the cache is updated with the new variant configuration,
- the temporary directory is correctly removed.
- the notifications are correctly registered.
- the simulation outputs are not copied.
"""
generator = SnapshotGenerator(
cache=variant_study_service.cache,
Expand Down Expand Up @@ -802,6 +812,9 @@ def before_cursor_execute(conn, cursor, statement: str, parameters, context, exe
}
]

# Check: the simulation outputs are not copied.
assert not (snapshot_dir / "output").exists()

@with_db_context
def test_generate__with_user_dir(
self,
Expand Down
4 changes: 2 additions & 2 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antares-web",
"version": "2.15.5",
"version": "2.15.6",
"private": true,
"engines": {
"node": "18.16.1"
Expand Down
Loading