Skip to content

Commit 39c0c04

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-migrate-dy-scheduler-part-1
2 parents da3e431 + 62244f5 commit 39c0c04

File tree

103 files changed

+4153
-850
lines changed

Some content is hidden

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

103 files changed

+4153
-850
lines changed

.github/prompts/update-user-messages.prompt.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
mode: 'edit'
33
description: 'Update user messages'
4+
model: Claude Sonnet 3.5
45
---
56

67
This prompt guide is for updating user-facing messages in ${file} or ${selection}
@@ -43,7 +44,17 @@ When modifying user messages, follow **as close as possible** these rules:
4344
user_message("Unable to load project.", _version=1)
4445
```
4546

46-
3. **Message Style**: Follow **strictly** the guidelines in `${workspaceFolder}/docs/user-messages-guidelines.md`
47+
3. **Message Style**: Follow **STRICTLY ALL 10 GUIDELINES** in `${workspaceFolder}/docs/user-messages-guidelines.md`:
48+
- Be Clear and Concise
49+
- Provide Specific and Actionable Information
50+
- Avoid Technical Jargon
51+
- Use a Polite and Non-Blaming Tone
52+
- Avoid Negative Words and Phrases
53+
- Place Messages Appropriately
54+
- Use Inline Validation When Possible
55+
- Avoid Using All-Caps and Excessive Punctuation
56+
- **Use Humor Sparingly** - Avoid casual phrases like "Oops!", "Whoops!", or overly informal language
57+
- Offer Alternative Solutions or Support
4758

4859
4. **Preserve Context**: Ensure the modified message conveys the same meaning and context as the original.
4960

@@ -56,8 +67,10 @@ When modifying user messages, follow **as close as possible** these rules:
5667
# After
5768
user_message("Your session has expired. Please log in again.", _version=3)
5869
```
70+
5971
6. **Replace 'Study' by 'Project'**: If the message contains the word 'Study', replace it with 'Project' to align with our terminology.
6072

73+
7. **Professional Tone**: Maintain a professional, helpful tone. Avoid humor, casual expressions, or overly informal language that might not be appropriate for all users or situations.
6174

6275
## Examples
6376

@@ -91,4 +104,14 @@ return HttpErrorInfo(status.HTTP_404_NOT_FOUND, user_message("User not found.",
91104
return HttpErrorInfo(status.HTTP_404_NOT_FOUND, user_message("The requested user could not be found.", _version=2))
92105
```
93106

94-
Remember: The goal is to improve clarity and helpfulness for end-users while maintaining accurate versioning for tracking changes.
107+
### Example 4: Removing Humor (Guideline 9)
108+
109+
```python
110+
# Before
111+
user_message("Oops! Something went wrong, but we've noted it down and we'll sort it out ASAP. Thanks for your patience!")
112+
113+
# After
114+
user_message("Something went wrong on our end. We've been notified and will resolve this issue as soon as possible. Thank you for your patience.", _version=1)
115+
```
116+
117+
Remember: The goal is to improve clarity and helpfulness for end-users while maintaining accurate versioning for tracking changes. **Always check that your updated messages comply with ALL 10 guidelines, especially avoiding humor and maintaining a professional tone.**

packages/celery-library/tests/unit/test_tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from random import randint
1212

1313
import pytest
14-
from celery import Celery, Task
15-
from celery.contrib.abortable import AbortableTask
14+
from celery import Celery, Task # pylint: disable=no-name-in-module
15+
from celery.contrib.abortable import AbortableTask # pylint: disable=no-name-in-module
1616
from celery_library.errors import TransferrableCeleryError
1717
from celery_library.task import register_task
1818
from celery_library.task_manager import CeleryTaskManager

packages/models-library/src/models_library/api_schemas_long_running_tasks/base.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from collections.abc import Awaitable, Callable
33
from typing import Annotated, TypeAlias
44

5-
from pydantic import BaseModel, Field, field_validator, validate_call
5+
from pydantic import BaseModel, ConfigDict, Field, field_validator, validate_call
6+
from pydantic.config import JsonDict
67

78
_logger = logging.getLogger(__name__)
89

@@ -23,6 +24,22 @@ class TaskProgress(BaseModel):
2324
message: ProgressMessage = ""
2425
percent: ProgressPercent = 0.0
2526

27+
@staticmethod
28+
def _update_json_schema_extra(schema: JsonDict) -> None:
29+
schema.update(
30+
{
31+
"examples": [
32+
{
33+
"task_id": "3ac48b54-a48d-4c5e-a6ac-dcaddb9eaa59",
34+
"message": "Halfway done",
35+
"percent": 0.5,
36+
}
37+
]
38+
}
39+
)
40+
41+
model_config = ConfigDict(json_schema_extra=_update_json_schema_extra)
42+
2643
# used to propagate progress updates internally
2744
_update_callback: Callable[["TaskProgress"], Awaitable[None]] | None = None
2845

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

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
from typing import Annotated, TypeAlias
33

4-
from pydantic import Field, HttpUrl
4+
from pydantic import ConfigDict, Field, HttpUrl
55

66
from ..functions import (
77
Function,
@@ -141,6 +141,45 @@ class RegisteredProjectFunctionGet(RegisteredProjectFunction, OutputSchema):
141141
modified_at: Annotated[datetime.datetime, Field(alias="lastChangeDate")]
142142
access_rights: dict[GroupID, FunctionGroupAccessRightsGet]
143143
thumbnail: HttpUrl | None = None
144+
model_config = ConfigDict(
145+
populate_by_name=True,
146+
json_schema_extra={
147+
"examples": [
148+
{
149+
"function_class": "PROJECT",
150+
"title": "Example Project Function",
151+
"description": "This is an example project function.",
152+
"input_schema": {
153+
"schema_content": {
154+
"type": "object",
155+
"properties": {"input1": {"type": "integer"}},
156+
},
157+
"schema_class": "application/schema+json",
158+
},
159+
"output_schema": {
160+
"schema_content": {
161+
"type": "object",
162+
"properties": {"output1": {"type": "string"}},
163+
},
164+
"schema_class": "application/schema+json",
165+
},
166+
"default_inputs": None,
167+
"project_id": "11111111-1111-1111-1111-111111111111",
168+
"uid": "22222222-2222-2222-2222-222222222222",
169+
"created_at": "2024-01-01T12:00:00",
170+
"modified_at": "2024-01-02T12:00:00",
171+
"access_rights": {
172+
"5": {
173+
"read": True,
174+
"write": False,
175+
"execute": True,
176+
}
177+
},
178+
"thumbnail": None,
179+
},
180+
]
181+
},
182+
)
144183

145184

146185
class SolverFunctionToRegister(SolverFunction, InputSchema): ...

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

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,37 @@ class ProjectFunction(FunctionBase):
114114

115115

116116
class RegisteredProjectFunction(ProjectFunction, RegisteredFunctionBase):
117-
pass
117+
model_config = ConfigDict(
118+
populate_by_name=True,
119+
json_schema_extra={
120+
"examples": [
121+
{
122+
"function_class": "PROJECT",
123+
"title": "Example Project Function",
124+
"description": "This is an example project function.",
125+
"input_schema": {
126+
"schema_content": {
127+
"type": "object",
128+
"properties": {"input1": {"type": "integer"}},
129+
},
130+
"schema_class": "application/schema+json",
131+
},
132+
"output_schema": {
133+
"schema_content": {
134+
"type": "object",
135+
"properties": {"output1": {"type": "string"}},
136+
},
137+
"schema_class": "application/schema+json",
138+
},
139+
"default_inputs": None,
140+
"project_id": "11111111-1111-1111-1111-111111111111",
141+
"uid": "22222222-2222-2222-2222-222222222222",
142+
"created_at": "2024-01-01T12:00:00",
143+
"modified_at": "2024-01-02T12:00:00",
144+
},
145+
]
146+
},
147+
)
118148

119149

120150
SolverJobID: TypeAlias = UUID
@@ -160,21 +190,12 @@ class FunctionJobBase(BaseModel):
160190
function_class: FunctionClass
161191

162192

163-
class RegisteredFunctionJobBase(FunctionJobBase):
164-
uid: FunctionJobID
165-
created_at: datetime.datetime
166-
167-
168193
class ProjectFunctionJob(FunctionJobBase):
169194
function_class: Literal[FunctionClass.PROJECT] = FunctionClass.PROJECT
170195
project_job_id: ProjectID | None
171196
job_creation_task_id: TaskID | None
172197

173198

174-
class RegisteredProjectFunctionJob(ProjectFunctionJob, RegisteredFunctionJobBase):
175-
pass
176-
177-
178199
class RegisteredProjectFunctionJobPatch(BaseModel):
179200
function_class: Literal[FunctionClass.PROJECT] = FunctionClass.PROJECT
180201
title: str | None
@@ -191,10 +212,6 @@ class SolverFunctionJob(FunctionJobBase):
191212
job_creation_task_id: TaskID | None
192213

193214

194-
class RegisteredSolverFunctionJob(SolverFunctionJob, RegisteredFunctionJobBase):
195-
pass
196-
197-
198215
class RegisteredSolverFunctionJobPatch(BaseModel):
199216
function_class: Literal[FunctionClass.SOLVER] = FunctionClass.SOLVER
200217
title: str | None
@@ -209,10 +226,6 @@ class PythonCodeFunctionJob(FunctionJobBase):
209226
function_class: Literal[FunctionClass.PYTHON_CODE] = FunctionClass.PYTHON_CODE
210227

211228

212-
class RegisteredPythonCodeFunctionJob(PythonCodeFunctionJob, RegisteredFunctionJobBase):
213-
pass
214-
215-
216229
class RegisteredPythonCodeFunctionJobPatch(BaseModel):
217230
function_class: Literal[FunctionClass.PYTHON_CODE] = FunctionClass.PYTHON_CODE
218231
title: str | None
@@ -226,6 +239,24 @@ class RegisteredPythonCodeFunctionJobPatch(BaseModel):
226239
Field(discriminator="function_class"),
227240
]
228241

242+
243+
class RegisteredFunctionJobBase(FunctionJobBase):
244+
uid: FunctionJobID
245+
created_at: datetime.datetime
246+
247+
248+
class RegisteredProjectFunctionJob(ProjectFunctionJob, RegisteredFunctionJobBase):
249+
pass
250+
251+
252+
class RegisteredSolverFunctionJob(SolverFunctionJob, RegisteredFunctionJobBase):
253+
pass
254+
255+
256+
class RegisteredPythonCodeFunctionJob(PythonCodeFunctionJob, RegisteredFunctionJobBase):
257+
pass
258+
259+
229260
RegisteredFunctionJob: TypeAlias = Annotated[
230261
RegisteredProjectFunctionJob
231262
| RegisteredPythonCodeFunctionJob
@@ -245,6 +276,36 @@ class FunctionJobStatus(BaseModel):
245276
status: str
246277

247278

279+
class RegisteredFunctionJobWithStatusBase(RegisteredFunctionJobBase, FunctionJobBase):
280+
status: FunctionJobStatus
281+
282+
283+
class RegisteredProjectFunctionJobWithStatus(
284+
RegisteredProjectFunctionJob, RegisteredFunctionJobWithStatusBase
285+
):
286+
pass
287+
288+
289+
class RegisteredSolverFunctionJobWithStatus(
290+
RegisteredSolverFunctionJob, RegisteredFunctionJobWithStatusBase
291+
):
292+
pass
293+
294+
295+
class RegisteredPythonCodeFunctionJobWithStatus(
296+
RegisteredPythonCodeFunctionJob, RegisteredFunctionJobWithStatusBase
297+
):
298+
pass
299+
300+
301+
RegisteredFunctionJobWithStatus: TypeAlias = Annotated[
302+
RegisteredProjectFunctionJobWithStatus
303+
| RegisteredPythonCodeFunctionJobWithStatus
304+
| RegisteredSolverFunctionJobWithStatus,
305+
Field(discriminator="function_class"),
306+
]
307+
308+
248309
class FunctionJobCollection(BaseModel):
249310
"""Model for a collection of function jobs"""
250311

@@ -279,6 +340,12 @@ class RegisteredFunctionJobDB(FunctionJobDB):
279340
created: datetime.datetime
280341

281342

343+
class RegisteredFunctionJobWithStatusDB(FunctionJobDB):
344+
uuid: FunctionJobID
345+
created: datetime.datetime
346+
status: str
347+
348+
282349
class FunctionDB(BaseModel):
283350
function_class: FunctionClass
284351
title: str = ""

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Literal, TypeAlias
22

33
from pydantic import BaseModel, ConfigDict
4+
from pydantic.config import JsonDict
45

56
# NOTE: keep a list of possible unit, and please use correct official unit names
67
ProgressUnit: TypeAlias = Literal["Byte"]
@@ -13,9 +14,10 @@ class ProgressStructuredMessage(BaseModel):
1314
unit: str | None = None
1415
sub: "ProgressStructuredMessage | None" = None
1516

16-
model_config = ConfigDict(
17-
json_schema_extra={
18-
"examples": [
17+
@staticmethod
18+
def _update_json_schema_extra(schema: JsonDict) -> None:
19+
schema.update(
20+
examples=[
1921
{
2022
"description": "some description",
2123
"current": 12.2,
@@ -39,8 +41,9 @@ class ProgressStructuredMessage(BaseModel):
3941
},
4042
},
4143
]
42-
}
43-
)
44+
)
45+
46+
model_config = ConfigDict(json_schema_extra=_update_json_schema_extra)
4447

4548

4649
UNITLESS = None
@@ -96,7 +99,17 @@ def composed_message(self) -> str:
9699
{
97100
"actual_value": 0.3,
98101
"total": 1.0,
99-
"message": ProgressStructuredMessage.model_config["json_schema_extra"]["examples"][2], # type: ignore [index]
102+
"message": {
103+
"description": "downloading",
104+
"current": 2.0,
105+
"total": 5,
106+
"sub": {
107+
"description": "port 2",
108+
"current": 12.2,
109+
"total": 123,
110+
"unit": "Byte",
111+
},
112+
},
100113
},
101114
]
102115
},

packages/notifications-library/src/notifications_library/_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class SharerData:
3030

3131
@dataclass(frozen=True)
3232
class ProductUIData:
33-
project_alias: str
3433
logo_url: str | None = (
3534
None # default_logo = "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-white.svg" in base.html
3635
)

packages/notifications-library/src/notifications_library/templates/on_share_project.email.content.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{% block content %}
44
<p>Dear {{ user.first_name or user.user_name }},</p>
55

6-
<p>Great news! {{ sharer.user_name }} has shared a {{ product.ui.project_alias }} with you on {{ product.display_name }}.</p>
6+
<p>Great news! {{ sharer.user_name }} has shared a project with you on {{ product.display_name }}.</p>
77

8-
<p>To view the {{ product.ui.project_alias }} and accept the sharing, follow below:</p>
8+
<p>To view the project and accept the sharing, follow below:</p>
99

1010
<p>
1111
{% if sharer.message %}

packages/notifications-library/src/notifications_library/templates/on_share_project.email.content.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Dear {{ user.first_name or user.user_name }},
22

3-
Great news! {{ sharer.user_name }} has shared a {{ product.ui.project_alias }} with you on {{ product.display_name }}.
3+
Great news! {{ sharer.user_name }} has shared a project with you on {{ product.display_name }}.
44

5-
To view the {{ product.ui.project_alias }} and accept the sharing, follow below:
5+
To view the project and accept the sharing, follow below:
66

77
{{ sharer.message }}
88
{{ accept_link }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
A {{ product.ui.project_alias }} was shared with you on {{ host }}
1+
A project was shared with you on {{ host }}

0 commit comments

Comments
 (0)