Skip to content

Commit d4d5fd9

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-port-change-notifications
2 parents ab3ace9 + 28c8ee5 commit d4d5fd9

File tree

6 files changed

+78
-33
lines changed

6 files changed

+78
-33
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ jobs:
12881288
uses: docker/setup-buildx-action@v3
12891289
with:
12901290
driver: docker-container
1291-
- uses: actions/[email protected].3
1291+
- uses: actions/[email protected].4
12921292
with:
12931293
node-version: ${{ matrix.node }}
12941294
cache: "npm"
@@ -2359,7 +2359,7 @@ jobs:
23592359
uses: actions/setup-python@v5
23602360
with:
23612361
python-version: ${{ matrix.python }}
2362-
- uses: actions/[email protected].3
2362+
- uses: actions/[email protected].4
23632363
with:
23642364
node-version: ${{ matrix.node }}
23652365
cache: "npm"

packages/service-library/src/servicelib/logging_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,8 @@ def guess_message_log_level(message: str) -> LogLevelInt:
392392
):
393393
return logging.WARNING
394394
return logging.INFO
395+
396+
397+
def set_parent_module_log_level(current_module: str, desired_log_level: int) -> None:
398+
parent_module = ".".join(current_module.split(".")[:-1])
399+
logging.getLogger(parent_module).setLevel(desired_log_level)

packages/service-library/tests/test_logging_utils.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
log_context,
1515
log_decorator,
1616
log_exceptions,
17+
set_parent_module_log_level,
1718
)
1819

1920
_logger = logging.getLogger(__name__)
@@ -322,3 +323,57 @@ def test_log_exceptions_and_reraise(caplog: pytest.LogCaptureFixture, level: int
322323

323324
assert len(caplog.records) == (1 if level != logging.NOTSET else 0)
324325
assert all(r.levelno == level for r in caplog.records)
326+
327+
328+
def test_set_parent_module_log_level_(caplog: pytest.LogCaptureFixture):
329+
caplog.clear()
330+
# emulates service logger
331+
logging.root.setLevel(logging.WARNING)
332+
333+
parent = logging.getLogger("parent")
334+
child = logging.getLogger("parent.child")
335+
336+
assert parent.level == logging.NOTSET
337+
assert child.level == logging.NOTSET
338+
339+
parent.debug("parent debug")
340+
child.debug("child debug")
341+
342+
parent.info("parent info")
343+
child.info("child info")
344+
345+
parent.warning("parent warning")
346+
child.warning("child warning")
347+
348+
assert "parent debug" not in caplog.text
349+
assert "child debug" not in caplog.text
350+
351+
assert "parent info" not in caplog.text
352+
assert "child info" not in caplog.text
353+
354+
assert "parent warning" in caplog.text
355+
assert "child warning" in caplog.text
356+
357+
caplog.clear()
358+
set_parent_module_log_level("parent.child", logging.INFO)
359+
360+
assert parent.level == logging.INFO
361+
assert child.level == logging.NOTSET
362+
363+
parent.debug("parent debug")
364+
child.debug("child debug")
365+
366+
parent.info("parent info")
367+
child.info("child info")
368+
369+
parent.warning("parent warning")
370+
child.warning("child warning")
371+
372+
assert "parent debug" not in caplog.text
373+
assert "child debug" not in caplog.text
374+
375+
assert "parent info" in caplog.text
376+
assert "child info" in caplog.text
377+
378+
assert "parent warning" in caplog.text
379+
assert "child warning" in caplog.text

services/static-webserver/client/source/class/osparc/study/StudyPricingUnits.js

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ qx.Class.define("osparc.study.StudyPricingUnits", {
2727

2828
this.__studyData = studyData;
2929

30-
this.showPricingUnits();
30+
this.__showPricingUnits();
3131
},
3232

3333
events: {
@@ -38,7 +38,7 @@ qx.Class.define("osparc.study.StudyPricingUnits", {
3838
members: {
3939
__studyData: null,
4040

41-
showPricingUnits: function() {
41+
__showPricingUnits: function() {
4242
const unitsLoading = () => this.fireEvent("loadingUnits");
4343
const unitsAdded = () => this.fireEvent("unitsReady");
4444
unitsLoading();
@@ -48,40 +48,16 @@ qx.Class.define("osparc.study.StudyPricingUnits", {
4848
const workbench = this.__studyData["workbench"];
4949
Object.keys(workbench).forEach(nodeId => {
5050
const node = workbench[nodeId];
51+
if (osparc.data.model.Node.isFrontend(node)) {
52+
return;
53+
}
5154
const nodePricingUnits = new osparc.study.NodePricingUnits(this.__studyData["uuid"], nodeId, node);
5255
this._add(nodePricingUnits);
5356
promises.push(nodePricingUnits.showPricingUnits());
5457
});
5558
}
5659
Promise.all(promises)
5760
.then(() => unitsAdded());
58-
},
59-
60-
__createPricingUnitsGroup: function(nodeLabel, pricingPlans, preselectedPricingUnit) {
61-
if (pricingPlans && "pricingUnits" in pricingPlans && pricingPlans["pricingUnits"].length) {
62-
const pricingUnitsLayout = osparc.study.StudyOptions.createGroupBox(nodeLabel);
63-
64-
const unitButtons = new osparc.study.PricingUnits(pricingPlans["pricingUnits"], preselectedPricingUnit);
65-
pricingUnitsLayout.add(unitButtons);
66-
67-
return {
68-
layout: pricingUnitsLayout,
69-
unitButtons
70-
};
71-
}
72-
return null;
73-
},
74-
75-
__pricingUnitSelected: function(nodeId, pricingPlanId, selectedPricingUnitId) {
76-
const params = {
77-
url: {
78-
studyId: this.__studyData["uuid"],
79-
nodeId,
80-
pricingPlanId,
81-
pricingUnitId: selectedPricingUnitId
82-
}
83-
};
84-
return osparc.data.Resources.fetch("studies", "putPricingUnit", params);
8561
}
8662
}
8763
});

services/web/server/src/simcore_service_webserver/garbage_collector/_core_disconnected.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ async def remove_disconnected_user_resources(
106106
# inform that the project can be closed on the backend side
107107
#
108108
try:
109+
_logger.info(
110+
"Closing services for project '%s'", resource_value
111+
)
109112
await remove_project_dynamic_services(
110113
user_id=user_id,
111114
project_uuid=f"{resource_value}",

services/web/server/src/simcore_service_webserver/garbage_collector/plugin.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from aiohttp import web
44
from servicelib.aiohttp.application_setup import ModuleCategory, app_module_setup
5+
from servicelib.logging_utils import set_parent_module_log_level
56

7+
from ..application_settings import get_application_settings
68
from ..login.plugin import setup_login_storage
79
from ..projects.db import setup_projects_db
810
from ..socketio.plugin import setup_socketio
@@ -11,14 +13,14 @@
1113
from ._tasks_users import create_background_task_for_trial_accounts
1214
from .settings import get_plugin_settings
1315

14-
logger = logging.getLogger(__name__)
16+
_logger = logging.getLogger(__name__)
1517

1618

1719
@app_module_setup(
1820
"simcore_service_webserver.garbage_collector",
1921
ModuleCategory.ADDON,
2022
settings_name="WEBSERVER_GARBAGE_COLLECTOR",
21-
logger=logger,
23+
logger=_logger,
2224
)
2325
def setup_garbage_collector(app: web.Application) -> None:
2426
# - project-api needs access to db
@@ -32,6 +34,10 @@ def setup_garbage_collector(app: web.Application) -> None:
3234

3335
app.cleanup_ctx.append(run_background_task)
3436

37+
set_parent_module_log_level(
38+
_logger.name, min(logging.INFO, get_application_settings(app).log_level)
39+
)
40+
3541
# NOTE: scaling web-servers will lead to having multiple tasks upgrading the db
3642
# not a huge deal. Instead this task runs in the GC.
3743
# If more tasks of this nature are needed, we should setup some sort of registration mechanism

0 commit comments

Comments
 (0)