Skip to content

Commit

Permalink
v2.19.0 (#2337)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvlecl authored Feb 10, 2025
2 parents 37366ec + ffda60c commit bf929d3
Show file tree
Hide file tree
Showing 1,258 changed files with 34,526 additions and 36,989 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Lint Commit Messages
name: commitlint
on: [pull_request]

permissions:
contents: read
pull-requests: read

jobs:
commitlint:
commit-messages-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: 💚 Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0

- name: 💚 Install dependencies
run: npm install
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: check license headers
name: license-header
on:
push:
branches:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- uses: isort/isort-action@master
- uses: isort/isort-action@v1.1.1
with:
sort-paths: antarest, tests
requirementsFiles: "requirements-dev.txt"
- name: Check with black
uses: psf/black@stable
with:
# Version of Black should match the versions set in `requirements-dev.txt`
version: "~=23.7.0"
version: "~=25.1.0"
options: --check --diff
- name: Check Typing (mypy)
#continue-on-error: true
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Cache node modules
uses: actions/cache@v4
with:
Expand All @@ -92,7 +92,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
Expand All @@ -112,7 +112,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
Expand All @@ -132,7 +132,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
Expand All @@ -156,7 +156,7 @@ jobs:
with:
name: python-code-coverage-report
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
uses: sonarsource/sonarcloud-github-action@v3.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: pr-title
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
pr-title-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: npm install @commitlint/[email protected]
- uses: JulienKode/[email protected]
35 changes: 0 additions & 35 deletions AntaresWebLinux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -54,45 +54,10 @@ antares_web_server_exe = EXE(antares_web_server_pyz,
entitlements_file=None , icon='resources/webapp/favicon.ico')


antares_tool_a = Analysis(['antarest/tools/cli.py'],
pathex=[],
binaries=[],
datas=[('./resources', './resources')],
hiddenimports=['cmath', 'sqlalchemy.sql.default_comparator', 'sqlalchemy.ext.baked'],
hookspath=['extra-hooks'],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
antares_tool_pyz = PYZ(antares_tool_a.pure, antares_tool_a.zipped_data,
cipher=block_cipher)
antares_tool_exe = EXE(antares_tool_pyz,
antares_tool_a.scripts,
[],
exclude_binaries=True,
name='AntaresTool',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )


coll = COLLECT(antares_web_server_exe,
antares_web_server_a.binaries,
antares_web_server_a.zipfiles,
antares_web_server_a.datas,
antares_tool_exe,
antares_tool_a.binaries,
antares_tool_a.zipfiles,
antares_tool_a.datas,
strip=False,
upx=True,
upx_exclude=[],
Expand Down
36 changes: 0 additions & 36 deletions AntaresWebWin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -53,46 +53,10 @@ antares_web_server_exe = EXE(antares_web_server_pyz,
codesign_identity=None,
entitlements_file=None , icon='resources/webapp/favicon.ico')


antares_tool_a = Analysis(['antarest/tools/cli.py'],
pathex=[],
binaries=[],
datas=[('./resources', './resources')],
hiddenimports=['cmath', 'sqlalchemy.sql.default_comparator', 'sqlalchemy.ext.baked'],
hookspath=['extra-hooks'],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
antares_tool_pyz = PYZ(antares_tool_a.pure, antares_tool_a.zipped_data,
cipher=block_cipher)
antares_tool_exe = EXE(antares_tool_pyz,
antares_tool_a.scripts,
[],
exclude_binaries=True,
name='AntaresTool',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )


coll = COLLECT(antares_web_server_exe,
antares_web_server_a.binaries,
antares_web_server_a.zipfiles,
antares_web_server_a.datas,
antares_tool_exe,
antares_tool_a.binaries,
antares_tool_a.zipfiles,
antares_tool_a.datas,
strip=False,
upx=True,
upx_exclude=[],
Expand Down
58 changes: 58 additions & 0 deletions alembic/versions/00a9ceb38842_add_study_version_to_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""add_study_version_to_commands
Revision ID: 00a9ceb38842
Revises: b33e1f57a60c
Create Date: 2024-10-28 10:30:15.877468
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy.orm import Session


# revision identifiers, used by Alembic.
revision = '00a9ceb38842'
down_revision = 'b33e1f57a60c'
branch_labels = None
depends_on = None


def upgrade():
# Add new column with empty data
with op.batch_alter_table("commandblock", schema=None) as batch_op:
batch_op.add_column(sa.Column('study_version', sa.String(length=36), server_default="fake_version", nullable=False))

# Create db connection
bind = op.get_bind()
session = Session(bind=bind)

# Reference tables
commandblock_table = table('commandblock', column('id'), column('study_id'))
study_table = table('study', column('id'), column('version'))

# Gathers commands by study_id
commands = session.query(commandblock_table).all()
mapping = {}
for cmd in commands:
cmd_id = cmd[0]
study_id = cmd[1]
mapping.setdefault(study_id, []).append(cmd_id)

# Gets studies versions
study_info = session.query(study_table).filter(study_table.c.id.in_(mapping)).all()

# Clean orphan commands
study_ids = {study_id for study_id, _ in study_info}
ids_to_remove = {cmd_id for study_id, cmd_ids in mapping.items() if study_id not in study_ids for cmd_id in cmd_ids}
bind.execute(commandblock_table.delete().where(commandblock_table.c.id.in_(ids_to_remove)))

# Insert new values
alter_table = table("commandblock", column("id"), column("study_id"), column("study_version"))
scalar_subq = sa.select(study_table.c.version).where(study_table.c.id == alter_table.c.study_id).scalar_subquery()
bind.execute(sa.update(alter_table).values(study_version=scalar_subq))


def downgrade():
with op.batch_alter_table("commandblock", schema=None) as batch_op:
batch_op.drop_column('study_version')
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""add_user_name_and_updated_at_to_commands
Revision ID: bae9c99bc42d
Revises: 00a9ceb38842
Create Date: 2024-11-29 09:13:04.292874
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'bae9c99bc42d'
down_revision = '00a9ceb38842'
branch_labels = None
depends_on = None

USER_ID_FKEY = 'commandblock_user_id_fk'


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('commandblock', schema=None) as batch_op:
batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('updated_at', sa.DateTime(), nullable=True))
batch_op.create_foreign_key(USER_ID_FKEY, 'identities', ['user_id'], ['id'], ondelete='SET NULL')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('commandblock', schema=None) as batch_op:
batch_op.drop_constraint(USER_ID_FKEY, type_='foreignkey')
batch_op.drop_column('updated_at')
batch_op.drop_column('user_id')
# ### end Alembic commands ###
6 changes: 3 additions & 3 deletions antarest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, RTE (https://www.rte-france.com)
# Copyright (c) 2025, RTE (https://www.rte-france.com)
#
# See AUTHORS.txt
#
Expand All @@ -19,9 +19,9 @@

# Standard project metadata

__version__ = "2.18.3"
__version__ = "2.19.0"
__author__ = "RTE, Antares Web Team"
__date__ = "2024-12-17"
__date__ = "2025-02-10"
# noinspection SpellCheckingInspection
__credits__ = "(c) Réseau de Transport de l’Électricité (RTE)"

Expand Down
2 changes: 1 addition & 1 deletion antarest/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, RTE (https://www.rte-france.com)
# Copyright (c) 2025, RTE (https://www.rte-france.com)
#
# See AUTHORS.txt
#
Expand Down
2 changes: 1 addition & 1 deletion antarest/core/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, RTE (https://www.rte-france.com)
# Copyright (c) 2025, RTE (https://www.rte-france.com)
#
# See AUTHORS.txt
#
Expand Down
2 changes: 1 addition & 1 deletion antarest/core/cache/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, RTE (https://www.rte-france.com)
# Copyright (c) 2025, RTE (https://www.rte-france.com)
#
# See AUTHORS.txt
#
Expand Down
2 changes: 1 addition & 1 deletion antarest/core/cache/business/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, RTE (https://www.rte-france.com)
# Copyright (c) 2025, RTE (https://www.rte-france.com)
#
# See AUTHORS.txt
#
Expand Down
9 changes: 8 additions & 1 deletion antarest/core/cache/business/local_chache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, RTE (https://www.rte-france.com)
# Copyright (c) 2025, RTE (https://www.rte-france.com)
#
# See AUTHORS.txt
#
Expand All @@ -15,6 +15,8 @@
import time
from typing import Dict, List, Optional

from typing_extensions import override

from antarest.core.config import CacheConfig
from antarest.core.interfaces.cache import ICache
from antarest.core.model import JSON
Expand All @@ -40,6 +42,7 @@ def __init__(self, config: CacheConfig = CacheConfig()):
daemon=True,
)

@override
def start(self) -> None:
self.checker_thread.start()

Expand All @@ -55,6 +58,7 @@ def checker(self) -> None:
for id in to_delete:
del self.cache[id]

@override
def put(self, id: str, data: JSON, duration: int = 3600) -> None: # Duration in second
with self.lock:
logger.info(f"Adding cache key {id}")
Expand All @@ -64,6 +68,7 @@ def put(self, id: str, data: JSON, duration: int = 3600) -> None: # Duration in
duration=duration,
)

@override
def get(self, id: str, refresh_duration: Optional[int] = None) -> Optional[JSON]:
res = None
with self.lock:
Expand All @@ -76,12 +81,14 @@ def get(self, id: str, refresh_duration: Optional[int] = None) -> Optional[JSON]
res = self.cache[id].data
return res

@override
def invalidate(self, id: str) -> None:
with self.lock:
logger.info(f"Removing cache key {id}")
if id in self.cache:
del self.cache[id]

@override
def invalidate_all(self, ids: List[str]) -> None:
with self.lock:
logger.info(f"Removing cache keys {ids}")
Expand Down
Loading

0 comments on commit bf929d3

Please sign in to comment.