Skip to content

Commit fd3148f

Browse files
authored
Merge branch 'master' into enh/request-account-with-phone
2 parents 542fb6d + 1f37607 commit fd3148f

File tree

79 files changed

+2214
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2214
-464
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ jobs:
10571057
unit-test-dynamic-sidecar:
10581058
needs: changes
10591059
if: ${{ needs.changes.outputs.dynamic-sidecar == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
1060-
timeout-minutes: 18 # if this timeout gets too small, then split the tests
1060+
timeout-minutes: 19 # if this timeout gets too small, then split the tests
10611061
name: "[unit] dynamic-sidecar"
10621062
runs-on: ${{ matrix.os }}
10631063
strategy:

packages/models-library/src/models_library/api_schemas_directorv2/dynamic_services.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from ..resource_tracker import HardwareInfo, PricingInfo
77
from ..services import ServicePortKey
8+
from ..services_creation import CreateServiceMetricsAdditionalParams
89
from ..services_resources import ServiceResourcesDict, ServiceResourcesDictHelpers
910
from ..wallets import WalletInfo
1011
from .dynamic_services_service import RunningDynamicServiceDetails, ServiceDetails
@@ -104,3 +105,11 @@ class GetProjectInactivityResponse(BaseModel):
104105
is_inactive: bool
105106

106107
model_config = ConfigDict(json_schema_extra={"example": {"is_inactive": "false"}})
108+
109+
110+
class ContainersComposeSpec(BaseModel):
111+
docker_compose_yaml: str
112+
113+
114+
class ContainersCreate(BaseModel):
115+
metrics_params: CreateServiceMetricsAdditionalParams

packages/service-library/requirements/_fastapi.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
#
55

6-
6+
asgi-lifespan
77
fastapi[standard]
88
fastapi-lifespan-manager
99
httpx[http2]

packages/service-library/requirements/_fastapi.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ anyio==4.8.0
55
# httpx
66
# starlette
77
# watchfiles
8+
asgi-lifespan==2.1.0
9+
# via -r requirements/_fastapi.in
810
asgiref==3.8.1
911
# via opentelemetry-instrumentation-asgi
1012
certifi==2025.1.31
@@ -129,7 +131,9 @@ sentry-sdk==2.35.0
129131
shellingham==1.5.4
130132
# via typer
131133
sniffio==1.3.1
132-
# via anyio
134+
# via
135+
# anyio
136+
# asgi-lifespan
133137
starlette==0.47.2
134138
# via fastapi
135139
typer==0.16.1

packages/service-library/requirements/_test.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ anyio==4.8.0
2020
# -c requirements/_fastapi.txt
2121
# httpx
2222
asgi-lifespan==2.1.0
23-
# via -r requirements/_test.in
23+
# via
24+
# -c requirements/_fastapi.txt
25+
# -r requirements/_test.in
2426
attrs==25.1.0
2527
# via
2628
# -c requirements/_aiohttp.txt

packages/service-library/src/servicelib/fastapi/long_running_tasks/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def retry_on_http_errors(
8888
assert asyncio.iscoroutinefunction(request_func)
8989

9090
@functools.wraps(request_func)
91-
async def request_wrapper(zelf: "Client", *args, **kwargs) -> Any:
91+
async def request_wrapper(zelf: "HttpClient", *args, **kwargs) -> Any:
9292
async for attempt in AsyncRetrying(
9393
stop=stop_after_attempt(max_attempt_number=3),
9494
wait=wait_exponential(min=1),
@@ -106,7 +106,7 @@ async def request_wrapper(zelf: "Client", *args, **kwargs) -> Any:
106106
return request_wrapper
107107

108108

109-
class Client:
109+
class HttpClient:
110110
"""
111111
This is a client that aims to simplify the requests to get the
112112
status, result and/or cancel of a long running task.

packages/service-library/src/servicelib/fastapi/long_running_tasks/_context_manager.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import logging
3+
import warnings
34
from collections.abc import AsyncIterator
45
from contextlib import asynccontextmanager
56
from typing import Any, Final
@@ -15,7 +16,7 @@
1516
TaskId,
1617
TaskStatus,
1718
)
18-
from ._client import Client
19+
from ._client import HttpClient
1920

2021
_logger = logging.getLogger(__name__)
2122

@@ -69,7 +70,7 @@ async def update(
6970

7071
@asynccontextmanager
7172
async def periodic_task_result(
72-
client: Client,
73+
client: HttpClient,
7374
task_id: TaskId,
7475
*,
7576
task_timeout: PositiveFloat,
@@ -95,6 +96,13 @@ async def periodic_task_result(
9596
raises: `asyncio.TimeoutError` NOTE: the remote task will also be removed
9697
"""
9798

99+
warnings.warn(
100+
"This context manager is deprecated and will be removed in future releases. "
101+
"Please use the `servicelib.long_running_tasks.lrt_api` instead.",
102+
DeprecationWarning,
103+
stacklevel=2,
104+
)
105+
98106
progress_manager = _ProgressManager(progress_callback)
99107

100108
async def _status_update() -> TaskStatus:

packages/service-library/src/servicelib/fastapi/long_running_tasks/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Provides a convenient way to return the result given a TaskId.
33
"""
44

5-
from ._client import Client, setup
5+
from ._client import HttpClient, setup
66
from ._context_manager import periodic_task_result # attach to the same object!
77

88
__all__: tuple[str, ...] = (
9-
"Client",
9+
"HttpClient",
1010
"periodic_task_result",
1111
"setup",
1212
)

packages/service-library/src/servicelib/long_running_tasks/_serialization.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,6 @@ def loads(obj_str: str) -> Any:
7878
msg = f"Could not reconstruct object from data: {data}"
7979
raise ValueError(msg) from e
8080

81+
if isinstance(data, Exception):
82+
raise data
8183
return data

packages/service-library/src/servicelib/long_running_tasks/errors.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ class TaskExceptionError(BaseLongRunningError):
3434
)
3535

3636

37+
class TaskRaisedUnserializableError(BaseLongRunningError):
38+
msg_template: str = (
39+
"Task {task_id} raised an exception that could not be serialized.\n"
40+
"Original exception: '{original_exception_str}'\n"
41+
"As a consequence, the following error was raised: '{exception}'"
42+
)
43+
44+
3745
class TaskClientTimeoutError(BaseLongRunningError):
3846
msg_template: str = (
3947
"Timed out after {timeout} seconds while awaiting '{task_id}' to complete"

0 commit comments

Comments
 (0)