Skip to content

Commit 273896e

Browse files
committed
Merge branch 'master' into 7634-opentelemetry-instrument-rpc-clients
2 parents d85dcb1 + 4bd14ca commit 273896e

File tree

12 files changed

+39
-42
lines changed

12 files changed

+39
-42
lines changed

packages/postgres-database/tests/test_comp_tasks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import asyncio
77
import json
8+
from collections.abc import AsyncIterator
89

910
import pytest
1011
from aiopg.sa.engine import Engine, SAConnection
@@ -25,7 +26,9 @@ async def db_connection(aiopg_engine: Engine) -> SAConnection:
2526

2627

2728
@pytest.fixture()
28-
async def db_notification_queue(db_connection: SAConnection) -> asyncio.Queue:
29+
async def db_notification_queue(
30+
db_connection: SAConnection,
31+
) -> AsyncIterator[asyncio.Queue]:
2932
listen_query = f"LISTEN {DB_CHANNEL_NAME};"
3033
await db_connection.execute(listen_query)
3134
notifications_queue: asyncio.Queue = db_connection.connection.notifies

packages/pytest-simcore/src/pytest_simcore/db_entries_mocks.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from typing import Any
88
from uuid import uuid4
99

10-
import aiopg.sa
1110
import pytest
1211
import sqlalchemy as sa
1312
from faker import Faker
@@ -20,6 +19,7 @@
2019
ProjectNodeCreate,
2120
ProjectNodesRepo,
2221
)
22+
from sqlalchemy.ext.asyncio import AsyncEngine
2323

2424

2525
@pytest.fixture()
@@ -63,7 +63,7 @@ def creator(**user_kwargs) -> dict[str, Any]:
6363

6464
@pytest.fixture
6565
async def project(
66-
aiopg_engine: aiopg.sa.engine.Engine, faker: Faker
66+
sqlalchemy_async_engine: AsyncEngine, faker: Faker
6767
) -> AsyncIterator[Callable[..., Awaitable[ProjectAtDB]]]:
6868
created_project_ids: list[str] = []
6969

@@ -86,17 +86,22 @@ async def creator(
8686
"workbench": {},
8787
}
8888
project_config.update(**project_overrides)
89-
async with aiopg_engine.acquire() as con, con.begin():
89+
async with sqlalchemy_async_engine.connect() as con, con.begin():
9090
result = await con.execute(
9191
projects.insert()
9292
.values(**project_config)
9393
.returning(sa.literal_column("*"))
9494
)
9595

96-
inserted_project = ProjectAtDB.model_validate(await result.first())
96+
inserted_project = ProjectAtDB.model_validate(result.one())
9797
project_nodes_repo = ProjectNodesRepo(project_uuid=project_uuid)
9898
# NOTE: currently no resources is passed until it becomes necessary
99-
default_node_config = {"required_resources": {}, "key": faker.pystr(), "version": faker.pystr(), "label": faker.pystr()}
99+
default_node_config = {
100+
"required_resources": {},
101+
"key": faker.pystr(),
102+
"version": faker.pystr(),
103+
"label": faker.pystr(),
104+
}
100105
if project_nodes_overrides:
101106
default_node_config.update(project_nodes_overrides)
102107
await project_nodes_repo.add(
@@ -113,17 +118,15 @@ async def creator(
113118
yield creator
114119

115120
# cleanup
116-
async with aiopg_engine.acquire() as con:
121+
async with sqlalchemy_async_engine.begin() as con:
117122
await con.execute(
118123
projects.delete().where(projects.c.uuid.in_(created_project_ids))
119124
)
120125
print(f"<-- delete projects {created_project_ids=}")
121126

122127

123128
@pytest.fixture
124-
def pipeline(
125-
postgres_db: sa.engine.Engine,
126-
) -> Iterator[Callable[..., dict[str, Any]]]:
129+
def pipeline(postgres_db: sa.engine.Engine) -> Iterator[Callable[..., dict[str, Any]]]:
127130
created_pipeline_ids: list[str] = []
128131

129132
def creator(**pipeline_kwargs) -> dict[str, Any]:

packages/pytest-simcore/src/pytest_simcore/helpers/playwright.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from dataclasses import dataclass, field
1414
from datetime import UTC, datetime, timedelta
1515
from enum import Enum, unique
16-
from pathlib import Path
1716
from typing import Any, Final
1817

1918
import arrow
@@ -590,7 +589,6 @@ def expected_service_running(
590589
press_start_button: bool,
591590
product_url: AnyUrl,
592591
is_service_legacy: bool,
593-
assertion_output_folder: Path,
594592
) -> Generator[ServiceRunning, None, None]:
595593
started = arrow.utcnow()
596594
with contextlib.ExitStack() as stack:
@@ -610,6 +608,10 @@ def expected_service_running(
610608
waiter = SocketIONodeProgressCompleteWaiter(
611609
node_id=node_id,
612610
logger=ctx.logger,
611+
max_idle_timeout=min(
612+
_SOCKET_IO_NODE_PROGRESS_WAITER_MAX_IDLE_TIMEOUT,
613+
timedelta(seconds=timeout / 1000 - 10),
614+
),
613615
)
614616
stack.enter_context(
615617
websocket.expect_event("framereceived", waiter, timeout=timeout)
@@ -647,7 +649,6 @@ def wait_for_service_running(
647649
press_start_button: bool,
648650
product_url: AnyUrl,
649651
is_service_legacy: bool,
650-
assertion_output_folder: Path,
651652
) -> FrameLocator:
652653
"""NOTE: if the service was already started this will not work as some of the required websocket events will not be emitted again
653654
In which case this will need further adjutment"""
@@ -669,6 +670,10 @@ def wait_for_service_running(
669670
waiter = SocketIONodeProgressCompleteWaiter(
670671
node_id=node_id,
671672
logger=ctx.logger,
673+
max_idle_timeout=min(
674+
_SOCKET_IO_NODE_PROGRESS_WAITER_MAX_IDLE_TIMEOUT,
675+
timedelta(seconds=timeout / 1000 - 10),
676+
),
672677
)
673678
stack.enter_context(
674679
websocket.expect_event("framereceived", waiter, timeout=timeout)

packages/pytest-simcore/src/pytest_simcore/helpers/playwright_sim4life.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
import re
44
from dataclasses import dataclass
5-
from pathlib import Path
65
from typing import Final, TypedDict
76

87
import arrow
@@ -108,7 +107,6 @@ def wait_for_launched_s4l(
108107
copy_workspace: bool,
109108
product_url: AnyUrl,
110109
is_service_legacy: bool,
111-
assertion_output_folder: Path,
112110
) -> WaitForS4LDict:
113111
with log_context(logging.INFO, "launch S4L") as ctx:
114112
predicate = S4LWaitForWebsocket(logger=ctx.logger)
@@ -136,7 +134,6 @@ def wait_for_launched_s4l(
136134
press_start_button=False,
137135
product_url=product_url,
138136
is_service_legacy=is_service_legacy,
139-
assertion_output_folder=assertion_output_folder,
140137
)
141138
s4l_websocket = ws_info.value
142139
ctx.logger.info("acquired S4L websocket!")

packages/pytest-simcore/src/pytest_simcore/postgres_service.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@
33
# pylint: disable=unused-variable
44

55
import json
6+
import warnings
67
from collections.abc import AsyncIterator, Iterator
78
from typing import Final
89

910
import docker
1011
import pytest
1112
import sqlalchemy as sa
1213
import tenacity
13-
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
14-
from pytest_simcore.helpers.typing_env import EnvVarsDict
1514
from sqlalchemy.ext.asyncio import AsyncEngine
1615
from tenacity.stop import stop_after_delay
1716
from tenacity.wait import wait_fixed
1817

1918
from .helpers.docker import get_service_published_port
2019
from .helpers.host import get_localhost_ip
20+
from .helpers.monkeypatch_envs import setenvs_from_dict
2121
from .helpers.postgres_tools import PostgresTestConfig, migrated_pg_tables_context
22+
from .helpers.typing_env import EnvVarsDict
2223

2324
_TEMPLATE_DB_TO_RESTORE = "template_simcore_db"
2425

@@ -212,6 +213,12 @@ async def aiopg_engine(
212213

213214
engine = await create_engine(str(postgres_db.url))
214215

216+
warnings.warn(
217+
"The 'aiopg_engine' fixture is deprecated and will be removed in a future release. "
218+
"Please use 'asyncpg_engine' fixture instead.",
219+
DeprecationWarning,
220+
stacklevel=2,
221+
)
215222
yield engine
216223

217224
if engine:

scripts/maintenance/computational-clusters/autoscaled_monitor/core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,11 @@ def _print_summary_as_json(
457457
"user_id": cluster.primary.user_id,
458458
"wallet_id": cluster.primary.wallet_id,
459459
"disk_space": cluster.primary.disk_space.human_readable(),
460-
"last_heartbeat": cluster.primary.last_heartbeat.isoformat(),
460+
"last_heartbeat": (
461+
cluster.primary.last_heartbeat.isoformat()
462+
if cluster.primary.last_heartbeat
463+
else "n/a"
464+
),
461465
},
462466
"workers": [
463467
{
@@ -806,6 +810,7 @@ async def terminate_dynamic_instances(
806810
rich.print("no instances found")
807811
raise typer.Exit(1)
808812

813+
assert state.ec2_resource_autoscaling # nosec
809814
_print_dynamic_instances(
810815
dynamic_autoscaled_instances,
811816
state.environment,

services/director-v2/requirements/_test.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
aio_pika
1313
aioboto3
14-
aiopg[sa]
1514
alembic # migration due to pytest_simcore.postgres_service2
1615
asgi_lifespan
1716
async-asgi-testclient # replacement for fastapi.testclient.TestClient [see b) below]

services/director-v2/requirements/_test.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ aiohttp==3.11.13
2121
# aiobotocore
2222
aioitertools==0.12.0
2323
# via aiobotocore
24-
aiopg==1.4.0
25-
# via -r requirements/_test.in
2624
aiormq==6.8.1
2725
# via
2826
# -c requirements/_base.txt
@@ -43,8 +41,6 @@ asgi-lifespan==2.1.0
4341
# via -r requirements/_test.in
4442
async-asgi-testclient==1.4.11
4543
# via -r requirements/_test.in
46-
async-timeout==4.0.3
47-
# via aiopg
4844
attrs==25.1.0
4945
# via
5046
# -c requirements/_base.txt
@@ -227,11 +223,6 @@ psutil==6.1.0
227223
# via
228224
# -c requirements/_base.txt
229225
# distributed
230-
psycopg2-binary==2.9.10
231-
# via
232-
# -c requirements/_base.txt
233-
# aiopg
234-
# sqlalchemy
235226
pytest==8.3.5
236227
# via
237228
# -r requirements/_test.in
@@ -299,7 +290,6 @@ sqlalchemy==1.4.54
299290
# -c requirements/../../../requirements/constraints.txt
300291
# -c requirements/_base.txt
301292
# -r requirements/_test.in
302-
# aiopg
303293
# alembic
304294
sqlalchemy2-stubs==0.0.2a38
305295
# via sqlalchemy

tests/e2e-playwright/tests/jupyterlabs/test_jupyterlab.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import re
1212
from collections.abc import Callable
1313
from dataclasses import dataclass
14-
from pathlib import Path
1514
from typing import Any, Final, Literal
1615

1716
from playwright.sync_api import Page, WebSocket
@@ -73,7 +72,6 @@ def test_jupyterlab(
7372
large_file_block_size: ByteSize,
7473
product_url: AnyUrl,
7574
is_service_legacy: bool,
76-
playwright_test_results_dir: Path,
7775
):
7876
# NOTE: this waits for the jupyter to send message, but is not quite enough
7977
with (
@@ -106,7 +104,6 @@ def test_jupyterlab(
106104
press_start_button=False,
107105
product_url=product_url,
108106
is_service_legacy=is_service_legacy,
109-
assertion_output_folder=playwright_test_results_dir,
110107
)
111108

112109
iframe = page.frame_locator("iframe")

tests/e2e-playwright/tests/sim4life/test_sim4life.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
from collections.abc import Callable
11-
from pathlib import Path
1211
from typing import Any
1312

1413
from playwright.sync_api import Page
@@ -35,7 +34,6 @@ def test_sim4life(
3534
check_videostreaming: bool,
3635
product_url: AnyUrl,
3736
is_service_legacy: bool,
38-
playwright_test_results_dir: Path,
3937
):
4038
if use_plus_button:
4139
project_data = create_project_from_new_button(service_key)
@@ -59,7 +57,6 @@ def test_sim4life(
5957
copy_workspace=False,
6058
product_url=product_url,
6159
is_service_legacy=is_service_legacy,
62-
assertion_output_folder=playwright_test_results_dir,
6360
)
6461
s4l_websocket = resp["websocket"]
6562
s4l_iframe = resp["iframe"]

0 commit comments

Comments
 (0)