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.16.6 #1965

Merged
merged 9 commits into from
Mar 4, 2024
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.5"
__version__ = "2.16.6"
__author__ = "RTE, Antares Web Team"
__date__ = "2024-02-29"
__date__ = "2024-03-04"
# noinspection SpellCheckingInspection
__credits__ = "(c) Réseau de Transport de l’Électricité (RTE)"

Expand Down
18 changes: 17 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Antares Web Changelog
=====================

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

### Features

* **ui-tasks:** add launcher metrics [`#1960`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1960)
* **ui-tasks:** auto refresh launcher metrics [`#1963`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1963)


### Bug Fixes

* **ui-results:** adjust date times for accurate frequency display [`#1960`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1960)
* **ui-common:** matrices display issues [`#1960`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1960)
* **ui-common:** download latest value of matrices [`#1962`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1962)


v2.16.5 (2024-02-29)
--------------------

Expand All @@ -18,7 +34,7 @@ v2.16.5 (2024-02-29)
* **ui-hydro:** disable stretch to fix display issue on some matrices [`#1945`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1945)
* **variants:** correct the generation of variant when a snapshot is removed [`#1947`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1947)
* **tags:** resolve issue with `study.additional_data.patch` attribute reading [`#1944`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1944)
* **study:** correct access to study `additional_data` (#1949) [`#1949`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1949)
* **study:** correct access to study `additional_data` [`#1949`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1949)
* **ui-tablemode:** create modal is frozen when submitting without column [`#1946`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1946)
* **ui-tablemode:** 'co2' column not working [`#1952`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1952)
* **ui:** add missing i18n dependency [`#1954`](https://github.com/AntaresSimulatorTeam/AntaREST/pull/1954)
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.5",
version="2.16.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.16.5
sonar.projectVersion=2.16.6
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 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.5",
"version": "2.16.6",
"private": true,
"type": "module",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion webapp/public/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@
"study.postProcessing": "Post processing",
"study.timeLimit": "Time limit (h)",
"study.nbCpu": "Number of cores",
"study.clusterLoad": "Cluster load",
"study.allocatedCpuRate": "CPU usage",
"study.clusterLoadRate": "Cluster load",
"study.nbQueuedJobs": "Pending jobs",
"study.synthesis": "Synthesis",
"study.level": "Level",
"study.years": "Years",
Expand Down
4 changes: 3 additions & 1 deletion webapp/public/locales/fr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@
"study.postProcessing": "Post-traitement",
"study.timeLimit": "Limite de temps (h)",
"study.nbCpu": "Nombre de coeurs",
"study.clusterLoad": "Charge du cluster",
"study.allocatedCpuRate": "Utilisation CPU",
"study.clusterLoadRate": "Charge cluster",
"study.nbQueuedJobs": "Tâches en attente",
"study.synthesis": "Synthèse",
"study.level": "Niveau",
"study.years": "Années",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function HydroMatrix({ type }: Props) {
fetchFn={hydroMatrix.fetchFn}
disableEdit={hydroMatrix.disableEdit}
enablePercentDisplay={hydroMatrix.enablePercentDisplay}
stretch={hydroMatrix.stretch}
/>
</Root>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export interface HydroMatrixProps {
fetchFn?: fetchMatrixFn;
disableEdit?: boolean;
enablePercentDisplay?: boolean;
stretch?: boolean; // TODO: Remove this once the `EditableMatrix` component is refactored
}

type Matrices = Record<HydroMatrixType, HydroMatrixProps>;
Expand Down Expand Up @@ -121,7 +120,6 @@ export const MATRICES: Matrices = {
"Pumping Max Energy (Hours at Pmax)",
],
stats: MatrixStats.NOCOL,
stretch: false,
},
[HydroMatrixType.ReservoirLevels]: {
title: "Reservoir Levels",
Expand Down Expand Up @@ -177,7 +175,6 @@ export const MATRICES: Matrices = {
"December",
],
stats: MatrixStats.NOCOL,
stretch: false,
},
[HydroMatrixType.Allocation]: {
title: "Allocation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,36 @@ function ResultDetails() {
const dateTimeFromIndex = useMemo(() => {
if (!matrixRes.data) return [];

return matrixRes.data.index.map((dateTime) => {
const parsedDate = moment(dateTime, "MM/DD HH:mm");
return parsedDate.format("ddd D MMM HH:mm");
});
}, [matrixRes.data]);
// Annual format has a static string
if (timestep === Timestep.Annual) {
return ["Annual"];
}

// Original date/time format mapping for moment parsing
const parseFormat = {
[Timestep.Hourly]: "MM/DD HH:mm",
[Timestep.Daily]: "MM/DD",
[Timestep.Weekly]: "WW",
[Timestep.Monthly]: "MM",
}[timestep];

// Output formats for each timestep to match legacy UI requirements
const outputFormat = {
[Timestep.Hourly]: "DD MMM HH:mm I",
[Timestep.Daily]: "DD MMM I",
[Timestep.Weekly]: "WW",
[Timestep.Monthly]: "MMM",
}[timestep];

const needsIndex =
timestep === Timestep.Hourly || timestep === Timestep.Daily;

return matrixRes.data.index.map((dateTime, i) =>
moment(dateTime, parseFormat).format(
outputFormat.replace("I", needsIndex ? ` - ${i + 1}` : ""),
),
);
}, [matrixRes.data, timestep]);

////////////////////////////////////////////////////////////////
// Event Handlers
Expand Down Expand Up @@ -380,7 +405,6 @@ function ResultDetails() {
matrix={matrix}
matrixTime={false}
rowNames={dateTimeFromIndex}
stretch={false}
readOnly
/>
)
Expand Down
61 changes: 42 additions & 19 deletions webapp/src/components/App/Tasks/JobTableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Checkbox,
FormControlLabel,
Typography,
Skeleton,
} from "@mui/material";
import { useTranslation } from "react-i18next";
import RefreshIcon from "@mui/icons-material/Refresh";
Expand All @@ -27,8 +28,10 @@ import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import { grey } from "@mui/material/colors";
import { TaskView, TaskType } from "../../../common/types";
import usePromiseWithSnackbarError from "../../../hooks/usePromiseWithSnackbarError";
import { getLauncherLoad } from "../../../services/api/study";
import { getLauncherMetrics } from "../../../services/api/study";
import LinearProgressWithLabel from "../../common/LinearProgressWithLabel";
import UsePromiseCond from "../../common/utils/UsePromiseCond";
import { useInterval } from "react-use";

interface PropType {
content: TaskView[];
Expand All @@ -44,11 +47,10 @@ function JobTableView(props: PropType) {
useState<boolean>(false);
const [currentContent, setCurrentContent] = useState<TaskView[]>(content);

const { data: load, reload: reloadLauncherLoad } =
usePromiseWithSnackbarError(() => getLauncherLoad(), {
errorMessage: t("study.error.launchLoad"),
deps: [],
});
const launcherMetrics = usePromiseWithSnackbarError(getLauncherMetrics, {
errorMessage: t("study.error.launchLoad"),
deps: [],
});

const applyFilter = useCallback(
(taskList: TaskView[]) => {
Expand Down Expand Up @@ -87,6 +89,9 @@ function JobTableView(props: PropType) {
setCurrentContent(applyFilter(content));
}, [content, applyFilter]);

// Refresh launcher metrics every minute
useInterval(launcherMetrics.reload, 60_000);

return (
<Box
sx={{
Expand All @@ -109,29 +114,47 @@ function JobTableView(props: PropType) {
>
<Box
sx={{
width: "30%",
width: "60%",
display: "flex",
justifyContent: "flex-start",
alignItems: "flex-end",
alignContent: "center",
alignSelf: "center",
gap: 1,
}}
>
<Typography sx={{ mr: 2 }}>{t("study.clusterLoad")}</Typography>
{load && (
<LinearProgressWithLabel
indicator={load.slurm * 100}
size="60%"
tooltip={t("study.clusterLoad")}
gradiant
/>
)}
<UsePromiseCond
response={launcherMetrics}
keepLastResolvedOnReload
ifResolved={(data) => (
<>
<Typography>{t("study.allocatedCpuRate")}</Typography>
<LinearProgressWithLabel
indicator={Math.floor(data.allocatedCpuRate)}
size="20%"
tooltip={t("study.allocatedCpuRate")}
gradiant
/>
<Typography>{t("study.clusterLoadRate")}</Typography>
<LinearProgressWithLabel
indicator={Math.floor(data.clusterLoadRate)}
size="20%"
tooltip={t("study.clusterLoadRate")}
gradiant
/>
<Typography>
{t("study.nbQueuedJobs")}: {data.nbQueuedJobs}
</Typography>
</>
)}
ifPending={() => <Skeleton width={300} />}
/>
</Box>
<Box display="flex" alignItems="center">
<Tooltip title={t("tasks.refresh") as string} sx={{ mr: 4 }}>
<Button
color="primary"
onClick={() => {
refresh();
reloadLauncherLoad();
launcherMetrics.reload();
}}
variant="outlined"
>
Expand Down
5 changes: 1 addition & 4 deletions webapp/src/components/common/EditableMatrix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ interface PropTypes {
rowNames?: string[];
computStats?: MatrixStats;
isPercentDisplayEnabled?: boolean;
stretch?: boolean;
}

type CellType = Array<number | string | boolean>;
Expand Down Expand Up @@ -56,7 +55,6 @@ function EditableMatrix(props: PropTypes) {
rowNames,
computStats,
isPercentDisplayEnabled = false,
stretch = true,
} = props;
const { data = [], columns = [], index = [] } = matrix;
const prependIndex = index.length > 0 && matrixTime;
Expand Down Expand Up @@ -178,10 +176,9 @@ function EditableMatrix(props: PropTypes) {
data={grid}
width="100%"
height="100%"
stretchH={stretch ? "all" : "none"}
className="editableMatrix"
colHeaders
rowHeaderWidth={matrixRowNames ? 150 : undefined}
rowHeaderWidth={rowNames ? 150 : 50}
afterChange={(change, source) =>
onUpdate && handleSlice(change || [], source)
}
Expand Down
Loading
Loading