Skip to content

Commit a2264ec

Browse files
Merge branch 'master' into is1905/enhance-functions-listing-with-ordering-and-filtering
2 parents afe10c6 + 4c15e6c commit a2264ec

File tree

62 files changed

+1878
-543
lines changed

Some content is hidden

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

62 files changed

+1878
-543
lines changed

.github/actions/setup-simcore-env/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
uv-version:
1111
description: 'UV version to use'
1212
required: false
13-
default: '0.7.x'
13+
default: '0.8.x'
1414

1515
cache-dependency-glob:
1616
description: 'Glob pattern for cache dependency files'

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,31 @@ export DOCKER_REGISTRY ?= itisfoundation
8989

9090
MAKEFILES_WITH_OPENAPI_SPECS := $(shell find . -mindepth 2 -type f -name 'Makefile' -not -path '*/.*' -exec grep -l '^openapi-specs:' {} \; | xargs realpath)
9191

92+
# WSL 2 tricks
93+
define _check_wsl_mirroring
94+
$(shell \
95+
if [ "$(IS_WSL2)" = "WSL2" ]; then \
96+
win_user=$$(powershell.exe '$$env:UserName' | tr -d '\r' | tail -n 1 | xargs); \
97+
config_path="/mnt/c/Users/$$win_user/.wslconfig"; \
98+
if [ -f "$$config_path" ] && grep -q "networkingMode.*=.*mirrored" "$$config_path" 2>/dev/null; then \
99+
echo "true"; \
100+
else \
101+
echo "false"; \
102+
fi; \
103+
else \
104+
echo "false"; \
105+
fi \
106+
)
107+
endef
108+
109+
WSL_MIRRORED := $(_check_wsl_mirroring)
110+
111+
112+
ifeq ($(WSL_MIRRORED),true)
113+
get_my_ip := 127.0.0.1
114+
else
92115
get_my_ip := $(shell (hostname --all-ip-addresses || hostname -i) 2>/dev/null | cut --delimiter=" " --fields=1)
116+
endif
93117

94118
# NOTE: this is only for WSL2 as the WSL2 subsystem IP is changing on each reboot
95119
ifeq ($(IS_WSL2),WSL2)

api/specs/web-server/_functions.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010
from _common import as_query
1111
from fastapi import APIRouter, Depends, status
1212
from models_library.api_schemas_webserver.functions import (
13+
FunctionGroupAccessRightsGet,
14+
FunctionGroupAccessRightsUpdate,
1315
FunctionToRegister,
1416
RegisteredFunctionGet,
1517
RegisteredFunctionUpdate,
1618
)
1719
from models_library.generics import Envelope
20+
from models_library.groups import GroupID
1821
from simcore_service_webserver._meta import API_VTAG
22+
from simcore_service_webserver.functions._controller._functions_rest import (
23+
FunctionGroupPathParams,
24+
)
1925
from simcore_service_webserver.functions._controller._functions_rest_schemas import (
2026
FunctionGetQueryParams,
2127
FunctionPathParams,
@@ -75,3 +81,33 @@ async def update_function(
7581
async def delete_function(
7682
_path: Annotated[FunctionPathParams, Depends()],
7783
): ...
84+
85+
86+
@router.get(
87+
"/functions/{function_id}/groups",
88+
response_model=Envelope[dict[GroupID, FunctionGroupAccessRightsGet]],
89+
)
90+
async def get_function_groups(
91+
_path: Annotated[FunctionPathParams, Depends()],
92+
): ...
93+
94+
95+
@router.put(
96+
"/functions/{function_id}/groups/{group_id}",
97+
summary="Create or update a Function Group",
98+
response_model=Envelope[FunctionGroupAccessRightsGet],
99+
)
100+
async def create_or_update_function_group(
101+
_path: Annotated[FunctionGroupPathParams, Depends()],
102+
_body: FunctionGroupAccessRightsUpdate,
103+
): ...
104+
105+
106+
@router.delete(
107+
"/functions/{function_id}/groups/{group_id}",
108+
summary="Delete a Function Group",
109+
status_code=status.HTTP_204_NO_CONTENT,
110+
)
111+
async def delete_function_group(
112+
_path: Annotated[FunctionGroupPathParams, Depends()],
113+
): ...

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

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
from pydantic import BaseModel, ConfigDict, Field
5+
from pydantic.config import JsonDict
56

67
from ..basic_types import PortInt
78
from ..projects import ProjectID
@@ -88,40 +89,45 @@ class RunningDynamicServiceDetails(ServiceDetails):
8889
alias="service_message",
8990
)
9091

92+
@staticmethod
93+
def _update_json_schema_extra(schema: JsonDict) -> None:
94+
schema.update(
95+
{
96+
"examples": [ # legacy
97+
{
98+
"service_key": "simcore/services/dynamic/raw-graphs",
99+
"service_version": "2.10.6",
100+
"user_id": 1,
101+
"project_id": "32fb4eb6-ab30-11ef-9ee4-0242ac140008",
102+
"service_uuid": "0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
103+
"service_basepath": "/x/0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
104+
"service_host": "raw-graphs_0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
105+
"service_port": 4000,
106+
"published_port": None,
107+
"entry_point": "",
108+
"service_state": "running",
109+
"service_message": "",
110+
},
111+
# new style
112+
{
113+
"service_key": "simcore/services/dynamic/jupyter-math",
114+
"service_version": "3.0.3",
115+
"user_id": 1,
116+
"project_id": "32fb4eb6-ab30-11ef-9ee4-0242ac140008",
117+
"service_uuid": "6e3cad3a-eb64-43de-b476-9ac3c413fd9c",
118+
"boot_type": "V2",
119+
"service_host": "dy-sidecar_6e3cad3a-eb64-43de-b476-9ac3c413fd9c",
120+
"service_port": 8888,
121+
"service_state": "running",
122+
"service_message": "",
123+
},
124+
]
125+
}
126+
)
127+
91128
model_config = ConfigDict(
92129
ignored_types=(cached_property,),
93-
json_schema_extra={
94-
"examples": [
95-
# legacy
96-
{
97-
"service_key": "simcore/services/dynamic/raw-graphs",
98-
"service_version": "2.10.6",
99-
"user_id": 1,
100-
"project_id": "32fb4eb6-ab30-11ef-9ee4-0242ac140008",
101-
"service_uuid": "0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
102-
"service_basepath": "/x/0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
103-
"service_host": "raw-graphs_0cd049ba-cd6b-4a12-b416-a50c9bc8e7bb",
104-
"service_port": 4000,
105-
"published_port": None,
106-
"entry_point": "",
107-
"service_state": "running",
108-
"service_message": "",
109-
},
110-
# new style
111-
{
112-
"service_key": "simcore/services/dynamic/jupyter-math",
113-
"service_version": "3.0.3",
114-
"user_id": 1,
115-
"project_id": "32fb4eb6-ab30-11ef-9ee4-0242ac140008",
116-
"service_uuid": "6e3cad3a-eb64-43de-b476-9ac3c413fd9c",
117-
"boot_type": "V2",
118-
"service_host": "dy-sidecar_6e3cad3a-eb64-43de-b476-9ac3c413fd9c",
119-
"service_port": 8888,
120-
"service_state": "running",
121-
"service_message": "",
122-
},
123-
]
124-
},
130+
json_schema_extra=_update_json_schema_extra,
125131
)
126132

127133
@cached_property

packages/models-library/src/models_library/api_schemas_webserver/functions.py

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

66
from ..functions import (
77
Function,
8-
FunctionAccessRights,
98
FunctionBase,
109
FunctionClass,
1110
FunctionClassSpecificData,
@@ -49,6 +48,7 @@
4948
UnsupportedFunctionClassError,
5049
UnsupportedFunctionFunctionJobClassCombinationError,
5150
)
51+
from ..groups import GroupID
5252
from ..projects import ProjectID
5353
from ._base import InputSchema, OutputSchema
5454

@@ -114,11 +114,23 @@
114114
]
115115

116116

117+
class FunctionGroupAccessRightsGet(OutputSchema):
118+
read: bool
119+
write: bool
120+
execute: bool
121+
122+
123+
class FunctionGroupAccessRightsUpdate(InputSchema):
124+
read: bool
125+
write: bool
126+
execute: bool
127+
128+
117129
class RegisteredSolverFunctionGet(RegisteredSolverFunction, OutputSchema):
118130
uid: Annotated[FunctionID, Field(alias="uuid")]
119131
created_at: Annotated[datetime.datetime, Field(alias="creationDate")]
120132
modified_at: Annotated[datetime.datetime, Field(alias="lastChangeDate")]
121-
access_rights: FunctionAccessRights | None = None
133+
access_rights: dict[GroupID, FunctionGroupAccessRightsGet]
122134
thumbnail: HttpUrl | None = None
123135

124136

@@ -127,7 +139,7 @@ class RegisteredProjectFunctionGet(RegisteredProjectFunction, OutputSchema):
127139
project_id: Annotated[ProjectID, Field(alias="templateId")]
128140
created_at: Annotated[datetime.datetime, Field(alias="creationDate")]
129141
modified_at: Annotated[datetime.datetime, Field(alias="lastChangeDate")]
130-
access_rights: FunctionAccessRights | None = None
142+
access_rights: dict[GroupID, FunctionGroupAccessRightsGet]
131143
thumbnail: HttpUrl | None = None
132144

133145

packages/models-library/src/models_library/api_schemas_webserver/projects_nodes.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Annotated, Any, Literal, TypeAlias
33

44
from pydantic import ConfigDict, Field
5+
from pydantic.config import JsonDict
56

67
from ..access_rights import ExecutableAccessRights
78
from ..api_schemas_directorv2.dynamic_services import RetrieveDataOut
@@ -163,14 +164,20 @@ class NodeGetIdle(OutputSchema):
163164
def from_node_id(cls, node_id: NodeID) -> "NodeGetIdle":
164165
return cls(service_state="idle", service_uuid=node_id)
165166

166-
model_config = ConfigDict(
167-
json_schema_extra={
168-
"example": {
169-
"service_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
170-
"service_state": "idle",
167+
@staticmethod
168+
def _update_json_schema_extra(schema: JsonDict) -> None:
169+
schema.update(
170+
{
171+
"examples": [
172+
{
173+
"service_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
174+
"service_state": "idle",
175+
}
176+
]
171177
}
172-
}
173-
)
178+
)
179+
180+
model_config = ConfigDict(json_schema_extra=_update_json_schema_extra)
174181

175182

176183
class NodeGetUnknown(OutputSchema):

0 commit comments

Comments
 (0)