Skip to content

Commit

Permalink
v2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Mar 9, 2023
2 parents dcf5d14 + f80f2d9 commit e7c9ceb
Show file tree
Hide file tree
Showing 231 changed files with 23,193 additions and 3,503 deletions.
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

## Description

Provide a clear and concise description of the issue.
## Steps to Reproduce

### Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## Actual Behavior

Describe what actually happened.
## Expected Behavior

Describe what you expected to happen.
## Screenshots

If applicable, add screenshots to help explain your problem.
## Possible Solution

If you have a solution in mind, describe it here.
## Environment

- [ ] Production
- [ ] Staging
## Additional Information
### Add any other context about the problem here.

- If applicable, provide the study ID that this issue relates to:
- Any relevant logs or error messages: [e.g. console outputs, stack traces]
- Any relevant code snippets: [e.g. relevant function calls, configuration files]
- Any relevant library versions: [e.g. React 17.0.1]
- The date and time when the issue occurred:
- Browser and version: [e.g. Chrome 88, Safari 14]
- Operating System: [e.g. Windows 10, macOS 11.2]

29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'feature request'
assignees: ''

---

## Problem Statement

A concise statement that clearly defines the problem the feature is trying to solve, or user problem it addresses:

## Proposed Solution

A high-level description of the proposed solution, including:

- The desired outcome

- Screenshots or mockups that illustrate the desired outcome (if available)

- Any specific requirements or constraints for the feature

- Add any other context or examples to help explain the requested feature

## Developer Notes

- Any potential roadblocks or concerns: [e.g. dependencies on other features, limitations in technology]

9 changes: 0 additions & 9 deletions .github/issue-branch.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
max-parallel: 9
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
os: [windows-latest, ubuntu-20.04, macOS-latest]
python-version: [ 3.8 ]

steps:
Expand All @@ -35,7 +35,7 @@ jobs:
strategy:
max-parallel: 9
matrix:
os: [ windows-latest, ubuntu-latest, macOS-latest ]
os: [ windows-latest, ubuntu-20.04, macOS-latest ]
node-version: [ 10.x, 14.x ]
steps:
- name: Checkout github repo
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
max-parallel: 3
matrix:
os: [windows-latest, ubuntu-latest]
os: [windows-latest, ubuntu-20.04]

steps:
- name: Checkout github repo (+ download lfs dependencies)
Expand Down Expand Up @@ -46,18 +46,13 @@ jobs:
- name: Install Windows dependencies
if: matrix.os == 'windows-latest'
run: pip install -r requirements-windows.txt
- name: Fix symlink for windows
if: matrix.os == 'windows-latest'
run: |
rm antareslauncher
ln -s antares-launcher\antareslauncher antareslauncher
- name: Generate Windows binary
if: matrix.os == 'windows-latest'
run: |
git log -1 HEAD --format=%H > .\resources\commit_id
pyinstaller AntaresWebWin.spec
- name: Generate linux binary
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-20.04'
run: |
git log -1 HEAD --format=%H > .\resources\commit_id
pyinstaller AntaresWebLinux.spec
Expand All @@ -67,7 +62,7 @@ jobs:
git log -1 HEAD --format=%H > .\resources\commit_id
pyinstaller -F antarest\worker\archive_worker_service.py -n AntaresWebWorker --add-data ".\resources;.\resources"
- name: Generate Linux worker binary
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-20.04'
run: |
git log -1 HEAD --format=%H > .\resources\commit_id
pyinstaller -F antarest/worker/archive_worker_service.py -n AntaresWebWorker --add-data resources:resources
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
python-lint:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout github repo (+ download lfs dependencies)
uses: actions/checkout@v2
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
max-parallel: 9
matrix:
os: [windows-latest, ubuntu-latest]
os: [windows-latest, ubuntu-20.04]

steps:
- name: Checkout github repo (+ download lfs dependencies)
Expand All @@ -47,11 +47,6 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Fix symlink for windows
if: matrix.os == 'windows-latest'
run: |
rm antareslauncher
ln -s antares-launcher\antareslauncher antareslauncher
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -60,11 +55,11 @@ jobs:
run: |
pytest --cov antarest --cov-report xml
- name: Fix code coverage paths
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-20.04'
run: |
sed -i 's/\/home\/runner\/work\/AntaREST\/AntaREST/\/github\/workspace/g' coverage.xml
- name: Archive code coverage results
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: python-code-coverage-report
Expand All @@ -74,7 +69,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-20.04 ]
steps:
- name: Checkout github repo
uses: actions/checkout@v1
Expand Down Expand Up @@ -106,7 +101,7 @@ jobs:
path: webapp/coverage/lcov.info

sonarcloud:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
needs: [python-test, npm-test]
steps:
- uses: actions/checkout@v2
Expand All @@ -123,4 +118,4 @@ jobs:
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ COPY ./scripts /scripts
COPY ./alembic /alembic
COPY ./alembic.ini /alembic.ini

COPY ./antares-launcher /antares-launcher
RUN ln -s /antares-launcher/antareslauncher /antareslauncher
RUN mkdir /conf/antares-launcher
RUN cp /antares-launcher/requirements.txt /conf/antares-launcher/requirements.txt
# > IMPORTANT: The `antares-launcher` project (source files) is no longer needed,
# > because the `Antares-Launcher` Python library is now declared as a dependency
# > in the `requirements.txt` file.
# > In other words, we can dispense with the creation of the symbolic link.

# COPY ./antares-launcher /antares-launcher
# RUN ln -s /antares-launcher/antareslauncher /antareslauncher
# RUN mkdir /conf/antares-launcher
# RUN cp /antares-launcher/requirements.txt /conf/antares-launcher/requirements.txt

RUN ./scripts/install-debug.sh

Expand Down
1 change: 0 additions & 1 deletion antareslauncher

This file was deleted.

13 changes: 12 additions & 1 deletion antarest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
__version__ = "2.12.2"
"""
Antares Web
This module contains the project metadata.
"""
from pathlib import Path

# Standard project metadata

__version__ = "2.13.0"
__author__ = "RTE, Antares Web Team"
__date__ = "2023-03-09"
# noinspection SpellCheckingInspection
__credits__ = "(c) Réseau de Transport de l’Électricité (RTE)"

ROOT_DIR: Path = Path(__file__).resolve().parent
6 changes: 4 additions & 2 deletions antarest/core/cache/business/local_chache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ class LocalCacheElement(BaseModel):

class LocalCache(ICache):
def __init__(self, config: CacheConfig = CacheConfig()):
self.cache: Dict[str, LocalCacheElement] = dict()
self.cache: Dict[str, LocalCacheElement] = {}
self.lock = threading.Lock()
self.checker_delay = config.checker_delay
self.checker_thread = threading.Thread(
target=self.checker, daemon=True
target=self.checker,
name=self.__class__.__name__,
daemon=True,
)

def start(self) -> None:
Expand Down
9 changes: 5 additions & 4 deletions antarest/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class WorkspaceConfig:
def from_dict(data: JSON) -> "WorkspaceConfig":
return WorkspaceConfig(
path=Path(data["path"]),
groups=data.get("groups", list()),
groups=data.get("groups", []),
filter_in=data.get("filter_in", [".*"]),
filter_out=data.get("filter_out", list()),
filter_out=data.get("filter_out", []),
)


Expand Down Expand Up @@ -254,7 +254,7 @@ class LoggingConfig:
@staticmethod
def from_dict(data: JSON) -> "LoggingConfig":
logging_config: Dict[str, Any] = data or {}
logfile: Optional[str] = logging_config.get("logfile", None)
logfile: Optional[str] = logging_config.get("logfile")
return LoggingConfig(
logfile=Path(logfile) if logfile is not None else None,
json=logging_config.get("json", False),
Expand Down Expand Up @@ -287,6 +287,7 @@ class EventBusConfig:
Sub config object dedicated to eventbus module
"""

# noinspection PyUnusedLocal
@staticmethod
def from_dict(data: JSON) -> "EventBusConfig":
return EventBusConfig()
Expand All @@ -298,7 +299,7 @@ class CacheConfig:
Sub config object dedicated to cache module
"""

checker_delay: float = 0.2 # in ms
checker_delay: float = 0.2 # in seconds

@staticmethod
def from_dict(data: JSON) -> "CacheConfig":
Expand Down
8 changes: 8 additions & 0 deletions antarest/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,11 @@ def __init__(self, *district_ids: str):
class BadEditInstructionException(HTTPException):
def __init__(self, message: str) -> None:
super().__init__(HTTPStatus.BAD_REQUEST, message)


class CannotScanInternalWorkspace(HTTPException):
def __init__(self) -> None:
super().__init__(
HTTPStatus.BAD_REQUEST,
"You cannot scan the default internal workspace",
)
28 changes: 18 additions & 10 deletions antarest/core/interfaces/eventbus.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from abc import ABC, abstractmethod
from enum import Enum
from typing import Any, Callable, Optional, List, Awaitable

from pydantic import BaseModel
from typing import Any, Awaitable, Callable, List, Optional

from antarest.core.model import PermissionInfo
from pydantic import BaseModel


class EventType(str, Enum):
Expand Down Expand Up @@ -49,8 +48,8 @@ class EventChannelDirectory:
class Event(BaseModel):
type: EventType
payload: Any
permissions: PermissionInfo = PermissionInfo()
channel: Optional[str] = None
permissions: PermissionInfo
channel: str = ""


class IEventBus(ABC):
Expand Down Expand Up @@ -79,13 +78,22 @@ def add_listener(
type_filter: Optional[List[EventType]] = None,
) -> str:
"""
Add an event listener listener
@param listener listener callback
@param type_filter list of event types to listen to (or None to catch all)
Add a new event listener in the event bus.
The listener can listen to several types of events, depending on the filter
list. If not specified, the listener will listen to all event types.
Beware of the fact that in gunicorn, listeners will be called on the same event as many as there is workers
Note:
Be aware that in `gunicorn`, the listeners will be called on the same
event as many times as there are workers.
Args:
listener: callback of the listener
type_filter: list of event types to listen to (or `None` to catch everything).
Returns:
Listener registration ID (usually a UUID).
"""
pass

@abstractmethod
def remove_listener(self, listener_id: str) -> None:
Expand Down
6 changes: 5 additions & 1 deletion antarest/core/interfaces/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

class IService(ABC):
def __init__(self) -> None:
self.thread = threading.Thread(target=self._loop, daemon=True)
self.thread = threading.Thread(
target=self._loop,
name=self.__class__.__name__,
daemon=True,
)

def start(self, threaded: bool = True) -> None:
if threaded:
Expand Down
Loading

0 comments on commit e7c9ceb

Please sign in to comment.