Skip to content

Commit a2a3c5d

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-september-flaky-tests
2 parents aa97ef6 + 890f1ae commit a2a3c5d

File tree

97 files changed

+3206
-467
lines changed

Some content is hidden

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

97 files changed

+3206
-467
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from typing import Final
2+
3+
SOCKET_IO_SERVICE_STATUS_EVENT: Final[str] = "serviceStatus"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from enum import auto
2+
3+
from models_library.projects import ProjectID
4+
from models_library.projects_nodes_io import NodeID
5+
from models_library.services_types import ServicePortKey
6+
from models_library.utils.enums import StrAutoEnum
7+
from pydantic import BaseModel
8+
9+
10+
class OutputStatus(StrAutoEnum):
11+
UPLOAD_STARTED = auto()
12+
UPLOAD_WAS_ABORTED = auto()
13+
UPLOAD_FINISHED_SUCCESSFULLY = auto()
14+
UPLOAD_FINISHED_WITH_ERRROR = auto()
15+
16+
17+
class InputStatus(StrAutoEnum):
18+
DOWNLOAD_STARTED = auto()
19+
DOWNLOAD_WAS_ABORTED = auto()
20+
DOWNLOAD_FINISHED_SUCCESSFULLY = auto()
21+
DOWNLOAD_FINISHED_WITH_ERRROR = auto()
22+
23+
24+
class _PortStatusCommon(BaseModel):
25+
project_id: ProjectID
26+
node_id: NodeID
27+
port_key: ServicePortKey
28+
29+
30+
class OutputPortStatus(_PortStatusCommon):
31+
status: OutputStatus
32+
33+
34+
class InputPortSatus(_PortStatusCommon):
35+
status: InputStatus
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from typing import Final
22

33
SOCKET_IO_SERVICE_DISK_USAGE_EVENT: Final[str] = "serviceDiskUsage"
4+
SOCKET_IO_STATE_OUTPUT_PORTS_EVENT: Final[str] = "stateOutputPorts"
5+
SOCKET_IO_STATE_INPUT_PORTS_EVENT: Final[str] = "stateInputPorts"

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

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,36 @@ class NodeGet(OutputSchema):
9393

9494
class Config:
9595
schema_extra: ClassVar[dict[str, Any]] = {
96-
"example": {
97-
"published_port": 30000,
98-
"entrypoint": "/the/entry/point/is/here",
99-
"service_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
100-
"service_key": "simcore/services/comp/itis/sleeper",
101-
"service_version": "1.2.3",
102-
"service_host": "jupyter_E1O2E-LAH",
103-
"service_port": 8081,
104-
"service_basepath": "/x/E1O2E-LAH",
105-
"service_state": "pending",
106-
"service_message": "no suitable node (insufficient resources on 1 node)",
107-
"user_id": 123,
108-
}
96+
"examples": [
97+
# computational
98+
{
99+
"published_port": 30000,
100+
"entrypoint": "/the/entry/point/is/here",
101+
"service_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
102+
"service_key": "simcore/services/comp/itis/sleeper",
103+
"service_version": "1.2.3",
104+
"service_host": "jupyter_E1O2E-LAH",
105+
"service_port": 8081,
106+
"service_basepath": "/x/E1O2E-LAH",
107+
"service_state": "pending",
108+
"service_message": "no suitable node (insufficient resources on 1 node)",
109+
"user_id": 123,
110+
},
111+
# dynamic
112+
{
113+
"published_port": 30000,
114+
"entrypoint": "/the/entry/point/is/here",
115+
"service_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
116+
"service_key": "simcore/services/dynamic/some-dynamic-service",
117+
"service_version": "1.2.3",
118+
"service_host": "jupyter_E1O2E-LAH",
119+
"service_port": 8081,
120+
"service_basepath": "/x/E1O2E-LAH",
121+
"service_state": "pending",
122+
"service_message": "no suitable node (insufficient resources on 1 node)",
123+
"user_id": 123,
124+
},
125+
]
109126
}
110127

111128

packages/models-library/src/models_library/services_enums.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ class ServiceBootType(str, Enum):
1111
@functools.total_ordering
1212
@unique
1313
class ServiceState(Enum):
14+
FAILED = "failed"
15+
1416
PENDING = "pending"
1517
PULLING = "pulling"
1618
STARTING = "starting"
1719
RUNNING = "running"
18-
COMPLETE = "complete"
19-
FAILED = "failed"
20+
2021
STOPPING = "stopping"
2122

23+
COMPLETE = "complete"
24+
IDLE = "idle"
25+
2226
def __lt__(self, other):
2327
if self.__class__ is other.__class__:
2428
comparison_order = ServiceState.comparison_order()
@@ -39,6 +43,7 @@ def comparison_order() -> dict["ServiceState", int]:
3943
ServiceState.RUNNING: 4,
4044
ServiceState.STOPPING: 5,
4145
ServiceState.COMPLETE: 6,
46+
ServiceState.IDLE: 7,
4247
}
4348

4449

packages/models-library/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytest
1010

1111
pytest_plugins = [
12+
"pytest_simcore.faker_projects_data",
1213
"pytest_simcore.pydantic_models",
1314
"pytest_simcore.pytest_global_environs",
1415
"pytest_simcore.repository_paths",

packages/models-library/tests/test_utils_nodes.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
from models_library.utils.nodes import compute_node_hash
1717
from pydantic import AnyUrl, parse_obj_as
1818

19-
20-
@pytest.fixture()
21-
def node_id() -> NodeID:
22-
return uuid4()
23-
24-
2519
ANOTHER_NODE_ID = uuid4()
2620
ANOTHER_NODE_OUTPUT_KEY = "the_output_link"
2721
ANOTHER_NODE_PAYLOAD = {"outputs": {ANOTHER_NODE_OUTPUT_KEY: 36}}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from pydantic import SecretStr
2+
3+
4+
def _mask(value):
5+
"""
6+
Mask the password, showing only the first and last characters
7+
or *** if very short passwords
8+
"""
9+
if len(value) > 2:
10+
masked_value = value[0] + "*" * (len(value) - 2) + value[-1]
11+
else:
12+
# In case of very short passwords
13+
masked_value = "*" * len(value)
14+
return masked_value
15+
16+
17+
def _hash(value):
18+
"""Uses hash number to mask the password"""
19+
return f"hash:{hash(value)}"
20+
21+
22+
class Secret4TestsStr(SecretStr):
23+
"""Prints a hint of the secret
24+
TIP: Can be handy for testing
25+
"""
26+
27+
def _display(self) -> str | bytes:
28+
# SEE overrides _SecretBase._display
29+
value = self.get_secret_value()
30+
return _mask(value) if value else ""
31+
32+
33+
assert str(Secret4TestsStr("123456890")) == "1*******0"
34+
assert "1*******0" in repr(Secret4TestsStr("123456890"))

packages/service-integration/requirements/_base.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ jsonschema # pytest-plugin
1313
pytest # pytest-plugin
1414
pyyaml
1515
typer[all]
16+
yarl

packages/service-integration/requirements/_base.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ idna==3.7
3535
# via
3636
# email-validator
3737
# requests
38+
# yarl
3839
iniconfig==2.0.0
3940
# via pytest
4041
jinja2==3.1.4
@@ -57,6 +58,8 @@ markupsafe==2.1.5
5758
# via jinja2
5859
mdurl==0.1.2
5960
# via markdown-it-py
61+
multidict==6.1.0
62+
# via yarl
6063
orjson==3.10.7
6164
# via
6265
# -c requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
@@ -121,3 +124,5 @@ urllib3==2.2.2
121124
# -c requirements/../../../requirements/constraints.txt
122125
# docker
123126
# requests
127+
yarl==1.12.1
128+
# via -r requirements/_base.in

0 commit comments

Comments
 (0)