Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hotfix/v2.16.7' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Mar 7, 2024
2 parents f7f082a + 67125bd commit add0c63
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 17 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.16.6"
__version__ = "2.16.7"
__author__ = "RTE, Antares Web Team"
__date__ = "2024-03-04"
__date__ = "2024-03-05"
# noinspection SpellCheckingInspection
__credits__ = "(c) Réseau de Transport de l’Électricité (RTE)"

Expand Down
3 changes: 2 additions & 1 deletion antarest/launcher/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ def get_load(self) -> LauncherLoadDTO:
for job in self.job_result_repository.get_running()
)

cluster_load_approx = min(1.0, local_used_cpus / (os.cpu_count() or 1))
# The cluster load is approximated by the percentage of used CPUs.
cluster_load_approx = min(100.0, 100 * local_used_cpus / (os.cpu_count() or 1))

return LauncherLoadDTO(
allocated_cpu_rate=cluster_load_approx,
Expand Down
11 changes: 10 additions & 1 deletion antarest/launcher/ssh_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def execute_command(ssh_config: SSHConfigDTO, args: List[str]) -> Any:
command = " ".join(args)
try:
with ssh_client(ssh_config) as client: # type: ignore
stdin, stdout, stderr = client.exec_command(command, timeout=10)
_, stdout, stderr = client.exec_command(command, timeout=10)
output = stdout.read().decode("utf-8").strip()
error = stderr.read().decode("utf-8").strip()
except (
Expand Down Expand Up @@ -77,6 +77,15 @@ def parse_cpu_load(sinfo_output: str) -> float:
def calculates_slurm_load(ssh_config: SSHConfigDTO, partition: str) -> Tuple[float, float, int]:
"""
Returns the used/oad of the SLURM cluster or local machine in percentage and the number of queued jobs.
Args:
ssh_config: SSH configuration to connect to the SLURM server.
partition: Name of the partition to query, or empty string to query all partitions.
Returns:
- percentage of used CPUs in the cluster, in range [0, 100]
- percentage of CPU load in the cluster, in range [0, 100]
- number of queued jobs
"""
partition_arg = f"--partition={partition}" if partition else ""

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

v2.16.7 (2024-03-05)
--------------------

### Bug Fixes

* **desktop:** correct configuration and launcher load indicator for Antares Web Desktop [`#1969`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1969)


v2.16.6 (2024-03-04)
--------------------

Expand Down
5 changes: 5 additions & 0 deletions resources/deploy/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@ debug: false

root_path: "api"

server:
worker_threadpool_size: 12
services:
- watcher

logging:
logfile: ./tmp/antarest.log
16 changes: 12 additions & 4 deletions scripts/package_antares_web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set -e

ANTARES_SOLVER_VERSION="8.8"
ANTARES_SOLVER_FULL_VERSION="8.8.2"
ANTARES_SOLVER_FULL_VERSION="8.8.3"
ANTARES_SOLVER_VERSION_INT="880"

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
Expand All @@ -30,6 +30,10 @@ LINK="https://github.com/AntaresSimulatorTeam/Antares_Simulator/releases/downloa
echo "INFO: Preparing the Git Commit ID..."
git log -1 HEAD --format=%H > ${RESOURCES_DIR}/commit_id

echo "INFO: Remove the previous build if any..."
# Avoid the accumulation of files from previous builds (in development).
rm -rf ${DIST_DIR}

echo "INFO: Generating the Desktop version of the Web Application..."
if [[ "$OSTYPE" == "msys"* ]]; then
pushd ${PROJECT_DIR}
Expand All @@ -49,9 +53,13 @@ popd
echo "INFO: Creating destination directory '${ANTARES_SOLVER_DIR}'..."
mkdir -p "${ANTARES_SOLVER_DIR}"

echo "INFO: Downloading '$ANTARES_SOLVER_ZIPFILE_NAME' in '$ANTARES_SOLVER_DIR'..."
cd "$ANTARES_SOLVER_DIR" || exit
wget $LINK
if [ -f "$ANTARES_SOLVER_ZIPFILE_NAME" ]; then
echo "INFO: Using existing '$ANTARES_SOLVER_ZIPFILE_NAME' in '$ANTARES_SOLVER_DIR'..."
else
echo "INFO: Downloading '$ANTARES_SOLVER_ZIPFILE_NAME' in '$ANTARES_SOLVER_DIR'..."
cd "$ANTARES_SOLVER_DIR" || exit
wget $LINK
fi

echo "INFO: Uncompressing '$ANTARES_SOLVER_ZIPFILE_NAME'..."
if [[ "$OSTYPE" == "msys"* ]]; then
Expand Down
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.16.6",
version="2.16.7",
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.16.6
sonar.projectVersion=2.16.7
sonar.coverage.exclusions=antarest/gui.py,antarest/main.py,antarest/singleton_services.py,antarest/worker/archive_worker_service.py,webapp/**/*
4 changes: 2 additions & 2 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ def test_main(client: TestClient, admin_access_token: str, study_id: str) -> Non
res = client.get("/v1/launcher/load", headers=admin_headers)
assert res.status_code == 200, res.json()
launcher_load = LauncherLoadDTO.parse_obj(res.json())
assert launcher_load.allocated_cpu_rate == 1 / (os.cpu_count() or 1)
assert launcher_load.cluster_load_rate == 1 / (os.cpu_count() or 1)
assert launcher_load.allocated_cpu_rate == 100 / (os.cpu_count() or 1)
assert launcher_load.cluster_load_rate == 100 / (os.cpu_count() or 1)
assert launcher_load.nb_queued_jobs == 0
assert launcher_load.launcher_status == "SUCCESS"

Expand Down
4 changes: 2 additions & 2 deletions tests/launcher/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,8 @@ def test_save_solver_stats(self, tmp_path: Path) -> None:
),
],
{
"allocated_cpu_rate": min(1.0, 8.0 / (os.cpu_count() or 1)),
"cluster_load_rate": min(1.0, 8.0 / (os.cpu_count() or 1)),
"allocated_cpu_rate": min(100.0, 800 / (os.cpu_count() or 1)),
"cluster_load_rate": min(100.0, 800 / (os.cpu_count() or 1)),
"nb_queued_jobs": 0,
"launcher_status": "SUCCESS",
},
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.16.6",
"version": "2.16.7",
"private": true,
"type": "module",
"scripts": {
Expand Down

0 comments on commit add0c63

Please sign in to comment.