From a7dae6e373c91f254104a1ee98c1f9739d13bf88 Mon Sep 17 00:00:00 2001 From: Chris McCarthy Date: Mon, 22 Apr 2024 08:49:08 +0100 Subject: [PATCH 1/5] #2511 - Upgraded pydantic to version 2.7.0. Added ipywidgets to the dependencies (for #2300) --- CHANGELOG.md | 2 ++ pyproject.toml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d30ae5e2..fab36bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 3.0.0b9 - Removed deprecated `PrimaiteSession` class. +- Upgraded pydantic to version 2.7.0 +- Added ipywidgets to the dependencies ## [Unreleased] - Made requests fail to reach their target if the node is off diff --git a/pyproject.toml b/pyproject.toml index 19b5b7fa..7a6383b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,9 @@ dependencies = [ "stable-baselines3[extra]==2.1.0", "tensorflow==2.12.0", "typer[all]==0.9.0", - "pydantic==2.1.1", - "ray[rllib] == 2.8.0, < 3" + "pydantic==2.7.0", + "ray[rllib] == 2.8.0", + "ipywidgets" ] [tool.setuptools.dynamic] From 6060cbbc5babee998e9b4b1fdf0561896ff36c2c Mon Sep 17 00:00:00 2001 From: Chris McCarthy Date: Tue, 23 Apr 2024 09:04:17 +0100 Subject: [PATCH 2/5] #2511 - Put the ray rlllib dep back to "ray[rllib] == 2.8.0, < 3" --- pyproject.toml | 2 +- src/primaite/game/agent/observations/observations.py | 4 ++-- src/primaite/game/agent/rewards.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7a6383b6..9d0bc3a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ dependencies = [ "tensorflow==2.12.0", "typer[all]==0.9.0", "pydantic==2.7.0", - "ray[rllib] == 2.8.0", + "ray[rllib] == 2.8.0, < 3", "ipywidgets" ] diff --git a/src/primaite/game/agent/observations/observations.py b/src/primaite/game/agent/observations/observations.py index 0d6ff2a3..518fdf9f 100644 --- a/src/primaite/game/agent/observations/observations.py +++ b/src/primaite/game/agent/observations/observations.py @@ -1,6 +1,6 @@ """Manages the observation space for the agent.""" from abc import ABC, abstractmethod -from typing import Any, Dict, Iterable, Type +from typing import Any, Dict, Iterable, Type, Optional, Union from gymnasium import spaces from gymnasium.core import ObsType @@ -9,7 +9,7 @@ from pydantic import BaseModel, ConfigDict from primaite import getLogger _LOGGER = getLogger(__name__) -WhereType = Iterable[str | int] | None +WhereType = Optional[Iterable[Union[str, int]]] class AbstractObservation(ABC): diff --git a/src/primaite/game/agent/rewards.py b/src/primaite/game/agent/rewards.py index 726afaa4..0222bfcc 100644 --- a/src/primaite/game/agent/rewards.py +++ b/src/primaite/game/agent/rewards.py @@ -26,7 +26,7 @@ the structure: ``` """ from abc import abstractmethod -from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, TYPE_CHECKING +from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, TYPE_CHECKING, Union from typing_extensions import Never @@ -37,7 +37,7 @@ if TYPE_CHECKING: from primaite.game.agent.interface import AgentActionHistoryItem _LOGGER = getLogger(__name__) -WhereType = Iterable[str | int] | None +WhereType = Optional[Iterable[Union[str, int]]] class AbstractReward: From 2b19c8c91dbcfc34a53cc8cafd124d0de4e953ab Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Tue, 23 Apr 2024 09:51:56 +0100 Subject: [PATCH 3/5] #2551 upgrade ray to >2.9 and resolve logging error in db client --- pyproject.toml | 2 +- src/primaite/simulator/system/applications/database_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9d0bc3a6..333132bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ dependencies = [ "tensorflow==2.12.0", "typer[all]==0.9.0", "pydantic==2.7.0", - "ray[rllib] == 2.8.0, < 3", + "ray[rllib] >= 2.9, < 3", "ipywidgets" ] diff --git a/src/primaite/simulator/system/applications/database_client.py b/src/primaite/simulator/system/applications/database_client.py index d304c200..e21846a3 100644 --- a/src/primaite/simulator/system/applications/database_client.py +++ b/src/primaite/simulator/system/applications/database_client.py @@ -236,7 +236,7 @@ class DatabaseClient(Application): if not connection_id: msg = "Cannot run sql query, could not establish connection with the server." - self.parent.sys_log(msg) + self.parent.sys_log.error(msg) return False uuid = str(uuid4()) From 1eca20157bb7d25689a9b56bb07ebf9e7806107f Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Tue, 23 Apr 2024 09:04:49 +0000 Subject: [PATCH 4/5] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fab36bd8..d6932739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 3.0.0b9 - Removed deprecated `PrimaiteSession` class. - Upgraded pydantic to version 2.7.0 +- Upgraded Ray to version >= 2.9 - Added ipywidgets to the dependencies ## [Unreleased] From 8e008b6d24398c289e23cf55457a05cbf72a5194 Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Tue, 23 Apr 2024 13:54:56 +0100 Subject: [PATCH 5/5] #2511 Appease isort pre commit hook --- src/primaite/game/agent/observations/observations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primaite/game/agent/observations/observations.py b/src/primaite/game/agent/observations/observations.py index 518fdf9f..1ba87a30 100644 --- a/src/primaite/game/agent/observations/observations.py +++ b/src/primaite/game/agent/observations/observations.py @@ -1,6 +1,6 @@ """Manages the observation space for the agent.""" from abc import ABC, abstractmethod -from typing import Any, Dict, Iterable, Type, Optional, Union +from typing import Any, Dict, Iterable, Optional, Type, Union from gymnasium import spaces from gymnasium.core import ObsType