Skip to content

Commit

Permalink
Merge branch 'hotfix/v2.14.5' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	antarest/launcher/web.py
#	antarest/study/storage/rawstudy/model/filesystem/ini_file_node.py
#	antarest/study/storage/rawstudy/model/filesystem/matrix/input_series_matrix.py
#	antarest/study/storage/variantstudy/model/command/create_area.py
#	antarest/study/storage/variantstudy/model/command/create_renewables_cluster.py
#	antarest/study/storage/variantstudy/model/command/icommand.py
#	antarest/study/storage/variantstudy/model/command/remove_renewables_cluster.py
#	antarest/study/storage/variantstudy/variant_command_extractor.py
#	tests/integration/assets/launcher_mock.sh
#	tests/integration/conftest.py
#	tests/integration/test_studies_upgrade.py
#	tests/integration/variant_blueprint/test_renewable_cluster.py
#	tests/launcher/test_service.py
#	tests/storage/integration/test_exporter.py
#	webapp/package-lock.json
  • Loading branch information
laurent-laporte-pro committed Aug 11, 2023
2 parents 5d224eb + b090f44 commit 518921e
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 227 deletions.
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.14.4"
__version__ = "2.14.5"
__author__ = "RTE, Antares Web Team"
__date__ = "2023-06-28"
__date__ = "2023-08-11"
# noinspection SpellCheckingInspection
__credits__ = "(c) Réseau de Transport de l’Électricité (RTE)"

Expand Down
4 changes: 2 additions & 2 deletions antarest/launcher/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def remove_result(
response_model=LauncherEnginesDTO,
)
def get_engines() -> Any:
logger.info(f"Listing launch engines")
logger.info("Listing launch engines")
return LauncherEnginesDTO(engines=service.get_launchers())

@bp.get(
Expand All @@ -223,7 +223,7 @@ def get_load(
)
def get_solver_versions(
solver: str = Query(
"local",
"default",
examples={
"Default solver": {
"description": "Get the solver versions of the default configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@
import zipfile
from json import JSONDecodeError
from pathlib import Path
from typing import List, Optional, cast, Dict, Any, Union, Callable

from filelock import FileLock
from typing import Any, Callable, Dict, List, Optional, Union, cast

from antarest.core.model import JSON, SUB_JSON
from antarest.study.storage.rawstudy.io.reader import IniReader
from antarest.study.storage.rawstudy.io.reader.ini_reader import IReader
from antarest.study.storage.rawstudy.io.writer.ini_writer import (
IniWriter,
)
from antarest.study.storage.rawstudy.io.writer.ini_writer import IniWriter
from antarest.study.storage.rawstudy.model.filesystem.config.model import (
FileStudyTreeConfig,
)
from antarest.study.storage.rawstudy.model.filesystem.context import (
ContextServer,
)
from antarest.study.storage.rawstudy.model.filesystem.inode import (
INode,
)
from antarest.study.storage.rawstudy.model.filesystem.inode import INode
from filelock import FileLock


class IniFileNodeWarning(UserWarning):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np
import pandas as pd

from antarest.core.model import JSON
from antarest.core.utils.utils import StopWatch
from antarest.study.storage.rawstudy.model.filesystem.config.model import (
Expand Down
10 changes: 4 additions & 6 deletions antarest/study/storage/variantstudy/model/command/icommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ def apply(self, study_data: FileStudy) -> CommandOutput:
f"Failed to execute variant command {self.command_name}",
exc_info=e,
)
return CommandOutput(
status=False,
message=(
f"Unexpected exception occurred when trying"
f" to apply command {self.command_name}: {e}"
),
message = (
f"Unexpected exception occurred when trying"
f" to apply command {self.command_name}: {e}"
)
return CommandOutput(status=False, message=message)

@abstractmethod
def to_dto(self) -> CommandDTO:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from typing import Any, List, Tuple, Dict
from typing import Any, Dict, List, Tuple

from antarest.study.storage.rawstudy.model.filesystem.config.model import (
FileStudyTreeConfig,
Area,
FileStudyTreeConfig,
)
from antarest.study.storage.rawstudy.model.filesystem.factory import FileStudy
from antarest.study.storage.variantstudy.business.utils_binding_constraint import (
remove_area_cluster_from_binding_constraints,
)
from antarest.study.storage.variantstudy.model.command.common import (
CommandOutput,
CommandName,
CommandOutput,
)
from antarest.study.storage.variantstudy.model.command.icommand import (
ICommand,
MATCH_SIGNATURE_SEPARATOR,
ICommand,
)
from antarest.study.storage.variantstudy.model.model import CommandDTO

Expand Down
44 changes: 44 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
Antares Web Changelog
=====================

v2.14.5 (2023-08-11)
--------------------

### Features

* **ui-i18n:** add missing adequacy patch translations (#1680) ([8a06461](https://github.com/AntaresSimulatorTeam/AntaREST/commit/8a06461f4118227b94be7f587d37ea2430c70505))
* **ui:** removed the "patch" number from the list of versions in the simulation launch dialog when it's equal to 0 (#1698) ([1bc0156](https://github.com/AntaresSimulatorTeam/AntaREST/commit/1bc0156c3e08e321e9ccc396b95cadeabf1c1fc7))


### Bug Fixes

* **web:** modified API response model to prevent Watcher's ValidationError (#1526) ([b0e48d1](https://github.com/AntaresSimulatorTeam/AntaREST/commit/b0e48d1bd31463cb6ce5e9aefeff761c016d0b35))
* **xpansion:** corrected field types for Xpansion parameters (sensitivity analysis) ([3e481b9](https://github.com/AntaresSimulatorTeam/AntaREST/commit/3e481b9c8866ecc3dc42e351552e1ded036f62ad))
* **variant:** fixed implementation of the method for extracting the difference between two studies ([c534785](https://github.com/AntaresSimulatorTeam/AntaREST/commit/c5347851da867a19b990e05c6516bedc7508c8ce))
* **api:** added missing `use_leeway` field and validation rules in the hydro configuration form (#1650) ([27e46e5](https://github.com/AntaresSimulatorTeam/AntaREST/commit/27e46e5bda77aed65c84e82931d426b4b69a43bd))
* **export:** ZIP outputs are no longer compressed before export (used by Xpansion) (#1656) ([cba6261](https://github.com/AntaresSimulatorTeam/AntaREST/commit/cba62613e19712240f74f417854e95bd588ba95d))
* **log-parser:** simplified analysis and improved accuracy in displaying simulation progress for a study (#1682) ([2442674](https://github.com/AntaresSimulatorTeam/AntaREST/commit/24426749e9b6100eb3ab4b7159f615444242b95a))
* **table-mode:** corrected reading of UI information when the study has only one area (#1674) ([55c4181](https://github.com/AntaresSimulatorTeam/AntaREST/commit/55c4181b64959c5e191fed2256437fc95787199f))
* **table-mode:** issue to read area information in the case where the study has only one area (#1690) ([87d9617](https://github.com/AntaresSimulatorTeam/AntaREST/commit/87d961703cebdc037671fe73988903eb14dd9547))
* **command:** improve INI reader to support API PUT `/v1/studies/{uuid}/raw` (#1461) ([9e5cf25](https://github.com/AntaresSimulatorTeam/AntaREST/commit/9e5cf25b2f69890016ea36f3be0e9ac03c7695b6))
* **variant:** fixed time series deletion of renewable clusters (#1693) ([4ba1b17](https://github.com/AntaresSimulatorTeam/AntaREST/commit/4ba1b17dd3c1b8ea62a5a02f39d15e94a4b9a331))
* **launcher:** fixing launcher versions display and creation of the endpoint `/v1/launcher/versions` ([410afc2](https://github.com/AntaresSimulatorTeam/AntaREST/commit/410afc2e4ecbb296878985839ee27f84bc70d9d8))
and (#1672) ([a76f3a9](https://github.com/AntaresSimulatorTeam/AntaREST/commit/a76f3a9f01df0225d7fb54b20ba3ff599d749138))
* **launcher:** set the default number of cores to 22 (instead of 12) (#1695) ([2c89799](https://github.com/AntaresSimulatorTeam/AntaREST/commit/2c8979916d46a0ed46a67bc75ac9a2e365e3f164))


### Continuous Integration

* upgrade mypy to v1.4.1 and Black to v23.7.0 for improved typing and formatting (#1685) ([7cff8c5](https://github.com/AntaresSimulatorTeam/AntaREST/commit/7cff8c56c38728a1b29eae0221bcc8226e9ca80c))


### Tests

* enhanced integration tests: refactored fixtures and resources ([70af9b1](https://github.com/AntaresSimulatorTeam/AntaREST/commit/70af9b167bf54d534696da8b781edda56ccee788))


### Contributors

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


v2.14.4 (2023-06-28)
--------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="AntaREST",
version="2.14.4",
version="2.14.5",
description="Antares Server",
long_description=long_description,
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.14.4
sonar.projectVersion=2.14.5
sonar.coverage.exclusions=antarest/gui.py,antarest/main.py,antarest/singleton_services.py,antarest/worker/archive_worker_service.py,webapp/**/*
Empty file.
79 changes: 79 additions & 0 deletions tests/integration/launcher_blueprint/test_solver_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from typing import Sequence, Any
from unittest.mock import patch

import pytest
from starlette.testclient import TestClient


@pytest.mark.integration_test
class TestSolverVersions:
"""
The purpose of this unit test is to check the `/v1/launcher/versions` endpoint.
"""

def test_get_solver_versions(
self,
client: TestClient,
user_access_token: str,
) -> None:
# Fetch the default server version from the configuration file.
# NOTE: the value is defined in `tests/integration/assets/config.template.yml`.
res = client.get(
"/v1/launcher/versions",
headers={"Authorization": f"Bearer {user_access_token}"},
)
res.raise_for_status()
actual = res.json()
assert actual == ["700"]

res = client.get(
"/v1/launcher/versions?solver=default",
headers={"Authorization": f"Bearer {user_access_token}"},
)
res.raise_for_status()
actual = res.json()
assert actual == ["700"]

res = client.get(
"/v1/launcher/versions?solver=local",
headers={"Authorization": f"Bearer {user_access_token}"},
)
res.raise_for_status()
actual = res.json()
assert actual == ["700"]

res = client.get(
"/v1/launcher/versions?solver=slurm",
headers={"Authorization": f"Bearer {user_access_token}"},
)
res.raise_for_status()
actual = res.json()
assert actual == []

def test_get_solver_versions__default(
self,
client: TestClient,
user_access_token: str,
) -> None:
"""
This unit test checks that the default value
of the `solver` parameter is indeed "default".
"""

def get_versions(_: Any, solver: str) -> Sequence[str]:
# To distinguish between the default value and the local value,
# we use a different value for each `solver` value.
versions = {"default": ["123"], "local": ["456"], "slurm": ["798"]}
return versions[solver]

with patch(
"antarest.launcher.service.LauncherService.get_solver_versions",
new=get_versions,
):
res = client.get(
"/v1/launcher/versions",
headers={"Authorization": f"Bearer {user_access_token}"},
)
res.raise_for_status()
actual = res.json()
assert actual == ["123"]
Loading

0 comments on commit 518921e

Please sign in to comment.