Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-api-server-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Dec 9, 2024
2 parents b24e041 + 661f229 commit b5239b7
Show file tree
Hide file tree
Showing 70 changed files with 954 additions and 676 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2596,9 +2596,7 @@ jobs:
system-test-e2e-playwright,
system-test-environment-setup,
system-test-public-api,
system-test-swarm-deploy,
system-api-specs,
system-backwards-compatibility
system-test-swarm-deploy
]
runs-on: ubuntu-latest
steps:
Expand Down
12 changes: 12 additions & 0 deletions packages/common-library/src/common_library/unset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import Any


class UnSet:
VALUE: "UnSet"


UnSet.VALUE = UnSet()


def as_dict_exclude_unset(**params) -> dict[str, Any]:
return {k: v for k, v in params.items() if not isinstance(v, UnSet)}
15 changes: 15 additions & 0 deletions packages/common-library/tests/test_unset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import Any

from common_library.unset import UnSet, as_dict_exclude_unset


def test_as_dict_exclude_unset():
def f(
par1: str | UnSet = UnSet.VALUE, par2: int | UnSet = UnSet.VALUE
) -> dict[str, Any]:
return as_dict_exclude_unset(par1=par1, par2=par2)

assert f() == {}
assert f(par1="hi") == {"par1": "hi"}
assert f(par2=4) == {"par2": 4}
assert f(par1="hi", par2=4) == {"par1": "hi", "par2": 4}
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,33 @@ class RunningDynamicServiceDetails(ServiceDetails):
ignored_types=(cached_property,),
json_schema_extra={
"examples": [
# legacy
{
"boot_type": "V0",
"key": "simcore/services/dynamic/3dviewer",
"version": "2.4.5",
"user_id": 234,
"project_id": "dd1d04d9-d704-4f7e-8f0f-1ca60cc771fe",
"uuid": "75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"basepath": "/x/75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"host": "3dviewer_75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"internal_port": 8888,
"state": "running",
"message": "",
"node_uuid": "75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"service_key": "simcore/services/dynamic/raw-graphs",
"service_version": "2.10.6",
"user_id": 1,
"project_id": "32fb4eb6-ab30-11ef-9ee4-0242ac140008",
"service_uuid": "0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
"service_basepath": "/x/0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
"service_host": "raw-graphs_0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
"service_port": 4000,
"published_port": None,
"entry_point": "",
"service_state": "running",
"service_message": "",
},
# new style
{
"service_key": "simcore/services/dynamic/jupyter-math",
"service_version": "3.0.3",
"user_id": 1,
"project_id": "32fb4eb6-ab30-11ef-9ee4-0242ac140008",
"service_uuid": "6e3cad3a-eb64-43de-b476-9ac3c413fd9c",
"boot_type": "V2",
"key": "simcore/services/dynamic/dy-static-file-viewer-dynamic-sidecar",
"version": "1.0.0",
"user_id": 234,
"project_id": "dd1d04d9-d704-4f7e-8f0f-1ca60cc771fe",
"uuid": "75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"host": "dy-sidecar_75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"internal_port": 80,
"state": "running",
"message": "",
"node_uuid": "75c7f3f4-18f9-4678-8610-54a2ade78eaa",
"service_host": "dy-sidecar_6e3cad3a-eb64-43de-b476-9ac3c413fd9c",
"service_port": 8888,
"service_state": "running",
"service_message": "",
},
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
DynamicServiceStop,
)
from models_library.api_schemas_webserver.projects_nodes import NodeGet, NodeGetIdle
from models_library.projects import ProjectID
from models_library.projects_nodes_io import NodeID
from models_library.rabbitmq_basic_types import RPCMethodName
from models_library.users import UserID
from pydantic import NonNegativeInt, TypeAdapter
from servicelib.logging_utils import log_decorator
from servicelib.rabbitmq import RabbitMQRPCClient
Expand All @@ -29,6 +31,24 @@
_RPC_METHOD_NAME_ADAPTER: TypeAdapter[RPCMethodName] = TypeAdapter(RPCMethodName)


@log_decorator(_logger, level=logging.DEBUG)
async def list_tracked_dynamic_services(
rabbitmq_rpc_client: RabbitMQRPCClient,
*,
user_id: UserID | None = None,
project_id: ProjectID | None = None,
) -> list[DynamicServiceGet]:
result = await rabbitmq_rpc_client.request(
DYNAMIC_SCHEDULER_RPC_NAMESPACE,
_RPC_METHOD_NAME_ADAPTER.validate_python("list_tracked_dynamic_services"),
user_id=user_id,
project_id=project_id,
timeout_s=_RPC_DEFAULT_TIMEOUT_S,
)
assert isinstance(result, list) # nosec
return result


@log_decorator(_logger, level=logging.DEBUG)
async def get_service_status(
rabbitmq_rpc_client: RabbitMQRPCClient, *, node_id: NodeID
Expand Down
19 changes: 1 addition & 18 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,15 @@ pytest-asyncio<0.24
#
# Bugs
#

httpx!=0.28.0 # Waiting for fix in respx: https://github.com/lundberg/respx/pull/278



#
# Compatibility/coordination -----------------------------------------------------------------------------------------
#


pydantic>=2.10.0 # Avoids inter-version compatibility serialization errors as: _pickle.UnpicklingError: NEWOBJ class argument must be a type, not _AnnotatedAlias

# constraint since https://github.com/MagicStack/uvloop/releases/tag/v0.15.0: drops support for 3.5/3.6 Feb.2021
uvloop<0.15.0 ; python_version < '3.7'

# All backports libraries add environ markers
# NOTE: If >second dependency, this will annotate a marker in the compiled requirements file
#
async-exit-stack ; python_version < '3.7'
async-generator ; python_version < '3.7'
contextvars ; python_version < '3.7'
dataclasses ; python_version < '3.7'
importlib-metadata ; python_version < '3.8'
importlib-resources ; python_version < '3.9'
typing-extensions ; python_version < '3.7'
zipp ; python_version < '3.7'



#
Expand Down
Loading

0 comments on commit b5239b7

Please sign in to comment.