Skip to content

Commit e5f8e40

Browse files
authored
Merge branch 'master' into bugfix-use-celery-task-manager-in-function-job-service
2 parents 97ff8f9 + e006c47 commit e5f8e40

File tree

33 files changed

+816
-247
lines changed

33 files changed

+816
-247
lines changed

packages/service-library/src/servicelib/rabbitmq/_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RemoteMethodNotRegisteredError(BaseRPCError):
2424
class RPCServerError(BaseRPCError):
2525
msg_template = (
2626
"While running method '{method_name}' raised "
27-
"'{exc_type}': '{exc_message}'\n{traceback}"
27+
"'{exc_type}' [{error_code}]: '{exc_message}'\n{traceback}"
2828
)
2929

3030

packages/service-library/src/servicelib/rabbitmq/_rpc_router.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
from dataclasses import dataclass, field
77
from typing import Any, TypeVar
88

9+
from common_library.error_codes import create_error_code
910
from models_library.rabbitmq_basic_types import RPCMethodName
11+
from servicelib.logging_errors import create_troubleshootting_log_kwargs
1012

1113
from ..logging_utils import log_context
1214
from ._errors import RPCServerError
1315

1416
DecoratedCallable = TypeVar("DecoratedCallable", bound=Callable[..., Any])
1517

16-
# NOTE: this is equivalent to http access logs
17-
_logger = logging.getLogger("rpc.access")
18+
19+
_logger = logging.getLogger(
20+
# NOTE: this logger is equivalent to http access logs
21+
"rpc.access"
22+
)
1823

1924

2025
def _create_func_msg(func, args: tuple[Any, ...], kwargs: dict[str, Any]) -> str:
@@ -40,7 +45,9 @@ def expose(
4045
*,
4146
reraise_if_error_type: tuple[type[Exception], ...] | None = None,
4247
) -> Callable[[DecoratedCallable], DecoratedCallable]:
48+
4349
def _decorator(func: DecoratedCallable) -> DecoratedCallable:
50+
4451
@functools.wraps(func)
4552
async def _wrapper(*args, **kwargs):
4653
with log_context(
@@ -64,9 +71,19 @@ async def _wrapper(*args, **kwargs):
6471
):
6572
raise
6673

74+
error_code = create_error_code(exc)
6775
_logger.exception(
68-
"Unhandled exception on the rpc-server side. Re-raising as %s.",
69-
RPCServerError.__name__,
76+
# NOTE: equivalent to a 500 http status code error
77+
**create_troubleshootting_log_kwargs(
78+
f"Unhandled exception on the rpc-server side for '{func.__name__}'",
79+
error=exc,
80+
error_code=error_code,
81+
error_context={
82+
"rpc_method": func.__name__,
83+
"args": args,
84+
"kwargs": kwargs,
85+
},
86+
)
7087
)
7188
# NOTE: we do not return internal exceptions over RPC
7289
formatted_traceback = "\n".join(
@@ -77,6 +94,7 @@ async def _wrapper(*args, **kwargs):
7794
exc_type=f"{exc.__class__.__module__}.{exc.__class__.__name__}",
7895
exc_message=f"{exc}",
7996
traceback=f"{formatted_traceback}",
97+
error_code=error_code,
8098
) from None
8199

82100
self.routes[RPCMethodName(func.__name__)] = _wrapper

services/catalog/src/simcore_service_catalog/api/rpc/_services.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from models_library.users import UserID
2121
from pydantic import TypeAdapter, ValidationError, validate_call
2222
from pyinstrument import Profiler
23-
from servicelib.logging_utils import log_decorator
2423
from servicelib.rabbitmq import RPCRouter
2524
from servicelib.rabbitmq.rpc_interfaces.catalog.errors import (
2625
CatalogForbiddenError,
@@ -106,7 +105,6 @@ async def list_services_paginated(
106105
ValidationError,
107106
)
108107
)
109-
@log_decorator(_logger, level=logging.DEBUG)
110108
@_profile_rpc_call
111109
@validate_call(config={"arbitrary_types_allowed": True})
112110
async def get_service(
@@ -141,7 +139,6 @@ async def get_service(
141139
ValidationError,
142140
)
143141
)
144-
@log_decorator(_logger, level=logging.DEBUG)
145142
@validate_call(config={"arbitrary_types_allowed": True})
146143
async def update_service(
147144
app: FastAPI,
@@ -179,7 +176,6 @@ async def update_service(
179176
ValidationError,
180177
)
181178
)
182-
@log_decorator(_logger, level=logging.DEBUG)
183179
@validate_call(config={"arbitrary_types_allowed": True})
184180
async def check_for_service(
185181
app: FastAPI,
@@ -203,7 +199,6 @@ async def check_for_service(
203199

204200

205201
@router.expose(reraise_if_error_type=(CatalogForbiddenError, ValidationError))
206-
@log_decorator(_logger, level=logging.DEBUG)
207202
@validate_call(config={"arbitrary_types_allowed": True})
208203
async def batch_get_my_services(
209204
app: FastAPI,
@@ -233,7 +228,6 @@ async def batch_get_my_services(
233228

234229

235230
@router.expose(reraise_if_error_type=(ValidationError,))
236-
@log_decorator(_logger, level=logging.DEBUG)
237231
@validate_call(config={"arbitrary_types_allowed": True})
238232
async def list_my_service_history_latest_first(
239233
app: FastAPI,
@@ -281,7 +275,6 @@ async def list_my_service_history_latest_first(
281275
ValidationError,
282276
)
283277
)
284-
@log_decorator(_logger, level=logging.DEBUG)
285278
@validate_call(config={"arbitrary_types_allowed": True})
286279
async def get_service_ports(
287280
app: FastAPI,

services/director-v2/src/simcore_service_director_v2/modules/dask_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ async def _get_task_state(job_id: str) -> RunningState:
450450
parsed_event = TaskLifeCycleState.model_validate(dask_events[-1][1])
451451

452452
if parsed_event.state == RunningState.FAILED:
453+
log_error_context = {
454+
"job_id": job_id,
455+
"dask-scheduler": self.backend.scheduler_id,
456+
}
453457
try:
454458
# find out if this was a cancellation
455459
task_future: distributed.Future = (
@@ -461,10 +465,7 @@ async def _get_task_state(job_id: str) -> RunningState:
461465
timeout=_DASK_DEFAULT_TIMEOUT_S
462466
)
463467
assert isinstance(exception, Exception) # nosec
464-
log_error_context = {
465-
"job_id": job_id,
466-
"dask-scheduler": self.backend.scheduler_id,
467-
}
468+
468469
if isinstance(exception, TaskCancelledError):
469470
_logger.info(
470471
**create_troubleshootting_log_kwargs(

services/static-webserver/client/source/class/osparc/NewRelease.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ qx.Class.define("osparc.NewRelease", {
7373
const releaseTag = osparc.utils.Utils.getReleaseTag();
7474
const releaseLink = osparc.utils.Utils.getReleaseLink();
7575
const linkLabel = new osparc.ui.basic.LinkLabel().set({
76-
value: this.tr("What's new in ") + releaseTag,
76+
value: this.tr("What's New in ") + releaseTag,
7777
url: releaseLink,
7878
font: "link-label-14"
7979
});

services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,12 @@ qx.Class.define("osparc.dashboard.Dashboard", {
5454
osparc.wrapper.JsonTreeViewer.getInstance().init();
5555
osparc.wrapper.JsonFormatter.getInstance().init();
5656
osparc.wrapper.DOMPurify.getInstance().init();
57-
osparc.wrapper.RadialMenu.getInstance().init()
58-
.then(loaded => {
59-
if (loaded) {
60-
// hack to trigger fonts loading
61-
const menu = osparc.wrapper.RadialMenu.getInstance().createMenu();
62-
menu.show();
63-
menu.hide();
64-
}
65-
});
57+
osparc.wrapper.RadialMenu.getInstance().init();
58+
6659
this.__createMainViewLayout();
60+
61+
62+
qx.event.message.Bus.getInstance().subscribe("showTab", msg => this.showTab(msg.getData()), this);
6763
},
6864

6965
properties: {
@@ -99,6 +95,13 @@ qx.Class.define("osparc.dashboard.Dashboard", {
9995
return this.__appBrowser;
10096
},
10197

98+
showTab: function(tabId) {
99+
const tabFound = this.getSelectables().find(s => s.id === tabId);
100+
if (tabFound) {
101+
this.setSelection([tabFound]);
102+
}
103+
},
104+
102105
__createMainViewLayout: function() {
103106
const permissions = osparc.data.Permissions.getInstance();
104107
const tabIconSize = 20;

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -356,20 +356,24 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
356356
}
357357
}
358358

359-
// Show Quick Start if there are no studies in the root folder of the personal workspace
360-
const quickStartInfo = osparc.product.quickStart.Utils.getQuickStart();
361-
if (quickStartInfo) {
362-
const dontShowQuickStart = osparc.utils.Utils.localCache.getLocalStorageItem(quickStartInfo.localStorageStr);
363-
if (dontShowQuickStart === "true" || this.__dontQuickStart) {
364-
return;
365-
}
366-
const nStudies = "_meta" in resp ? resp["_meta"]["total"] : 0;
367-
if (
368-
nStudies === 0 &&
369-
this.getCurrentContext() === osparc.dashboard.StudyBrowser.CONTEXT.PROJECTS &&
370-
this.getCurrentWorkspaceId() === null &&
371-
this.getCurrentFolderId() === null
372-
) {
359+
// Check if this is the first time the user logged in
360+
const nStudies = "_meta" in resp ? resp["_meta"]["total"] : 0;
361+
if (
362+
nStudies === 0 &&
363+
this.getCurrentContext() === osparc.dashboard.StudyBrowser.CONTEXT.PROJECTS &&
364+
this.getCurrentWorkspaceId() === null &&
365+
this.getCurrentFolderId() === null
366+
) {
367+
// It is!
368+
// Open Support Center
369+
osparc.support.SupportCenter.openWindow();
370+
// and open the Introductory Quick Start if any
371+
const quickStartInfo = osparc.product.quickStart.Utils.getQuickStart();
372+
if (quickStartInfo) {
373+
const dontShowQuickStart = osparc.utils.Utils.localCache.getLocalStorageItem(quickStartInfo.localStorageStr);
374+
if (dontShowQuickStart === "true" || this.__dontQuickStart) {
375+
return;
376+
}
373377
const quickStartWindow = quickStartInfo.tutorial();
374378
quickStartWindow.center();
375379
quickStartWindow.open();

services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
5858
},
5959

6060
createSectionBox: function(title) {
61-
const box = osparc.ui.window.TabbedView.createSectionBox(title).set({
61+
const box = new osparc.widget.SectionBox(title).set({
6262
alignX: "left",
6363
maxWidth: 500
6464
});
@@ -337,9 +337,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
337337
const privacyModel = this.__userPrivacyModel = qx.data.marshal.Json.createModel(defaultModel, true);
338338

339339
const box = this.self().createSectionBox(this.tr("Privacy"));
340-
341-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Choose what others see."));
342-
box.add(label);
340+
box.addHelper(this.tr("Choose what others see."));
343341

344342
const hideUserName = new qx.ui.form.CheckBox().set({
345343
value: defaultModel.hideUserName
@@ -453,9 +451,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
453451

454452
__create2FASection: function() {
455453
const box = this.self().createSectionBox(this.tr("Two-Factor Authentication"));
456-
457-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Set your preferred method to use for two-factor authentication when signing in:"));
458-
box.add(label);
454+
box.addHelper(this.tr("Set your preferred method to use for two-factor authentication when signing in:"));
459455

460456
const form = new qx.ui.form.Form();
461457

@@ -659,9 +655,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
659655
__createDeleteAccount: function() {
660656
// layout
661657
const box = this.self().createSectionBox(this.tr("Delete Account"));
662-
663-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Request the deletion of your account."));
664-
box.add(label);
658+
box.addHelper(this.tr("Request the deletion of your account."));
665659

666660
const deleteBtn = new qx.ui.form.Button(this.tr("Delete Account")).set({
667661
appearance: "danger-button",

services/static-webserver/client/source/class/osparc/desktop/preferences/pages/ConfirmationsPage.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ qx.Class.define("osparc.desktop.preferences.pages.ConfirmationsPage", {
3939
members: {
4040
__createConfirmationsSettings: function() {
4141
// layout
42-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Ask for confirmation for the following actions:"));
42+
const label = new qx.ui.basic.Label(this.tr("Ask for confirmation for the following actions:")).set({
43+
font: "text-13",
44+
});
4345
this._add(label);
4446

4547
this._add(new qx.ui.core.Spacer(null, 10));
@@ -125,12 +127,8 @@ qx.Class.define("osparc.desktop.preferences.pages.ConfirmationsPage", {
125127

126128
__createExperimentalSettings: function() {
127129
// layout
128-
const box = osparc.ui.window.TabbedView.createSectionBox("Experimental preferences");
129-
130-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr(
131-
"This is a list of experimental preferences"
132-
));
133-
box.add(label);
130+
const box = new osparc.widget.SectionBox("Experimental preferences");
131+
box.addHelper(this.tr("This is a list of experimental preferences"));
134132

135133
const preferencesSettings = osparc.Preferences.getInstance();
136134

services/static-webserver/client/source/class/osparc/desktop/preferences/pages/GeneralPage.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
4646

4747
members: {
4848
__addCreditsIndicatorSettings: function() {
49-
const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Credits Indicator"));
49+
const box = new osparc.widget.SectionBox(this.tr("Credits Indicator"));
5050

5151
const form = new qx.ui.form.Form();
5252

@@ -93,10 +93,9 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
9393
},
9494

9595
__addInactivitySetting: function() {
96-
const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Automatic Shutdown of Idle Instances"));
96+
const box = new osparc.widget.SectionBox(this.tr("Automatic Shutdown of Idle Instances"));
9797

98-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Enter 0 to disable this function"), "text-13-italic");
99-
box.add(label);
98+
box.addHelper(this.tr("Enter 0 to disable this function"));
10099

101100
const form = new qx.ui.form.Form();
102101
const inactivitySpinner = new qx.ui.form.Spinner().set({
@@ -118,7 +117,7 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
118117
},
119118

120119
__addJobConcurrencySetting: function() {
121-
const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Job Concurrency"));
120+
const box = new osparc.widget.SectionBox(this.tr("Job Concurrency"));
122121
const form = new qx.ui.form.Form();
123122
const jobConcurrencySpinner = new qx.ui.form.Spinner().set({
124123
minimum: 1,
@@ -136,9 +135,9 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
136135
},
137136

138137
__addLowDiskSpaceSetting: function() {
139-
const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Low Disk Space Threshold"));
140-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Set the warning Threshold for Low Disk Space availability"), "text-13-italic");
141-
box.add(label);
138+
const box = new osparc.widget.SectionBox(this.tr("Low Disk Space Threshold"));
139+
box.addHelper(this.tr("Set the warning Threshold for Low Disk Space availability"));
140+
142141
const form = new qx.ui.form.Form();
143142
const diskUsageSpinner = new qx.ui.form.Spinner().set({
144143
minimum: 1,
@@ -157,10 +156,8 @@ qx.Class.define("osparc.desktop.preferences.pages.GeneralPage", {
157156
},
158157

159158
__addS4LUserPrivacySettings: function() {
160-
const box = osparc.ui.window.TabbedView.createSectionBox("Privacy Settings");
161-
162-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("Help us improve Sim4Life user experience"), "text-13-italic");
163-
box.add(label);
159+
const box = new osparc.widget.SectionBox("Privacy Settings");
160+
box.addHelper(this.tr("Help us improve Sim4Life user experience"));
164161

165162
const preferencesSettings = osparc.Preferences.getInstance();
166163

0 commit comments

Comments
 (0)