From fc1e2a7952581cd7de2942df902b1fd35092b274 Mon Sep 17 00:00:00 2001 From: Andrei Neagu <5694077+GitHK@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:18:35 +0100 Subject: [PATCH 1/8] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20dynamic-sidecar=20rpc?= =?UTF-8?q?=20interfce=20namespace=20is=20now=20tied=20to=20the=20node=5Fi?= =?UTF-8?q?d=20(#6614)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Andrei Neagu --- .../api_schemas_dynamic_sidecar/__init__.py | 9 --------- .../rpc_interfaces/dynamic_sidecar/disk_usage.py | 16 ++++++++++------ .../api/rpc/routes.py | 10 ++++++++-- .../tests/unit/test_api_rpc__disk_usage.py | 6 +++++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/packages/models-library/src/models_library/api_schemas_dynamic_sidecar/__init__.py b/packages/models-library/src/models_library/api_schemas_dynamic_sidecar/__init__.py index 705c568225e..e69de29bb2d 100644 --- a/packages/models-library/src/models_library/api_schemas_dynamic_sidecar/__init__.py +++ b/packages/models-library/src/models_library/api_schemas_dynamic_sidecar/__init__.py @@ -1,9 +0,0 @@ -from typing import Final - -from pydantic import parse_obj_as - -from ..rabbitmq_basic_types import RPCNamespace - -DYNAMIC_SIDECAR_RPC_NAMESPACE: Final[RPCNamespace] = parse_obj_as( - RPCNamespace, "dynamic-sidecar" -) diff --git a/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/dynamic_sidecar/disk_usage.py b/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/dynamic_sidecar/disk_usage.py index e8a23316e26..5938ad871ff 100644 --- a/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/dynamic_sidecar/disk_usage.py +++ b/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/dynamic_sidecar/disk_usage.py @@ -1,8 +1,8 @@ import logging -from models_library.api_schemas_dynamic_sidecar import DYNAMIC_SIDECAR_RPC_NAMESPACE from models_library.api_schemas_dynamic_sidecar.telemetry import DiskUsage -from models_library.rabbitmq_basic_types import RPCMethodName +from models_library.projects_nodes_io import NodeID +from models_library.rabbitmq_basic_types import RPCMethodName, RPCNamespace from pydantic import parse_obj_as from servicelib.logging_utils import log_decorator from servicelib.rabbitmq import RabbitMQRPCClient @@ -12,11 +12,15 @@ @log_decorator(_logger, level=logging.DEBUG) async def update_disk_usage( - rabbitmq_rpc_client: RabbitMQRPCClient, *, usage: dict[str, DiskUsage] + rabbitmq_rpc_client: RabbitMQRPCClient, + *, + node_id: NodeID, + usage: dict[str, DiskUsage], ) -> None: + rpc_namespace = RPCNamespace.from_entries( + {"service": "dy-sidecar", "node_id": f"{node_id}"} + ) result = await rabbitmq_rpc_client.request( - DYNAMIC_SIDECAR_RPC_NAMESPACE, - parse_obj_as(RPCMethodName, "update_disk_usage"), - usage=usage, + rpc_namespace, parse_obj_as(RPCMethodName, "update_disk_usage"), usage=usage ) assert result is None # nosec diff --git a/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/api/rpc/routes.py b/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/api/rpc/routes.py index 2772c9d863c..d1c0b0c2a1e 100644 --- a/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/api/rpc/routes.py +++ b/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/api/rpc/routes.py @@ -1,8 +1,9 @@ from fastapi import FastAPI -from models_library.api_schemas_dynamic_sidecar import DYNAMIC_SIDECAR_RPC_NAMESPACE +from models_library.rabbitmq_basic_types import RPCNamespace from servicelib.rabbitmq import RPCRouter from ...core.rabbitmq import get_rabbitmq_rpc_server +from ...core.settings import ApplicationSettings from . import _disk_usage ROUTERS: list[RPCRouter] = [ @@ -13,7 +14,12 @@ def setup_rpc_api_routes(app: FastAPI) -> None: async def startup() -> None: rpc_server = get_rabbitmq_rpc_server(app) + settings: ApplicationSettings = app.state.settings + + rpc_namespace = RPCNamespace.from_entries( + {"service": "dy-sidecar", "node_id": f"{settings.DY_SIDECAR_NODE_ID}"} + ) for router in ROUTERS: - await rpc_server.register_router(router, DYNAMIC_SIDECAR_RPC_NAMESPACE, app) + await rpc_server.register_router(router, rpc_namespace, app) app.add_event_handler("startup", startup) diff --git a/services/dynamic-sidecar/tests/unit/test_api_rpc__disk_usage.py b/services/dynamic-sidecar/tests/unit/test_api_rpc__disk_usage.py index cda0964a3b3..1383f165416 100644 --- a/services/dynamic-sidecar/tests/unit/test_api_rpc__disk_usage.py +++ b/services/dynamic-sidecar/tests/unit/test_api_rpc__disk_usage.py @@ -17,6 +17,7 @@ from settings_library.rabbit import RabbitSettings from settings_library.redis import RedisSettings from simcore_service_dynamic_sidecar.core.application import create_app +from simcore_service_dynamic_sidecar.core.settings import ApplicationSettings from simcore_service_dynamic_sidecar.modules.system_monitor._disk_usage import ( get_disk_usage_monitor, ) @@ -69,8 +70,11 @@ async def test_get_state(app: FastAPI, rpc_client: RabbitMQRPCClient): total=ByteSize(0), used=ByteSize(0), free=ByteSize(0), used_percent=0 ) } + settings: ApplicationSettings = app.state.settings - result = await disk_usage.update_disk_usage(rpc_client, usage=usage) + result = await disk_usage.update_disk_usage( + rpc_client, node_id=settings.DY_SIDECAR_NODE_ID, usage=usage + ) assert result is None assert get_disk_usage_monitor(app)._usage_overwrite == usage # noqa: SLF001 From 50076aa75837c65d37309cd750beacfcf19ab54f Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:57:36 +0100 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=90=9B=20[Frontend]=20Fix=20probe=20(?= =?UTF-8?q?#6620)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/class/osparc/ui/basic/LinkLabel.js | 17 ++++---- .../source/class/osparc/workbench/NodeUI.js | 40 ++++++++----------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js b/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js index ea126f1d6d1..5a44617d4d0 100644 --- a/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js +++ b/services/static-webserver/client/source/class/osparc/ui/basic/LinkLabel.js @@ -54,13 +54,16 @@ qx.Class.define("osparc.ui.basic.LinkLabel", { members: { __applyUrl: function(url) { - this.set({ - url, - cursor: "pointer", - font: "link-label-12" - }); - - this.addListener("click", this.__onClick); + if (url) { + this.set({ + cursor: "pointer", + font: "link-label-12", + }); + this.addListener("click", this.__onClick); + } else { + this.resetCursor(); + this.resetFont(); + } }, __onClick: function() { diff --git a/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js b/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js index 9d8a5f83b27..ce0bdb71043 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js +++ b/services/static-webserver/client/source/class/osparc/workbench/NodeUI.js @@ -474,15 +474,15 @@ qx.Class.define("osparc.workbench.NodeUI", { const width = 150; this.__setNodeUIWidth(width); - const label = new qx.ui.basic.Label().set({ + const linkLabel = new osparc.ui.basic.LinkLabel().set({ paddingLeft: 5, - font: "text-18" + font: "text-12" }); const chipContainer = this.getChildControl("chips"); - chipContainer.add(label); + chipContainer.add(linkLabel); - this.getNode().getPropsForm().addListener("linkFieldModified", () => this.__setProbeValue(label), this); - this.__setProbeValue(label); + this.getNode().getPropsForm().addListener("linkFieldModified", () => this.__setProbeValue(linkLabel), this); + this.__setProbeValue(linkLabel); }, __checkTurnIntoIteratorUI: function() { @@ -504,21 +504,19 @@ qx.Class.define("osparc.workbench.NodeUI", { } }, - __setProbeValue: function(label) { - const replaceByLinkLabel = val => { + __setProbeValue: function(linkLabel) { + const populateLinkLabel = linkInfo => { const download = true; - const locationId = val.store; - const fileId = val.path; + const locationId = linkInfo.store; + const fileId = linkInfo.path; osparc.store.Data.getInstance().getPresignedLink(download, locationId, fileId) .then(presignedLinkData => { if ("resp" in presignedLinkData && presignedLinkData.resp) { - const filename = val.filename || osparc.file.FilePicker.getFilenameFromPath(val); - const linkLabel = new osparc.ui.basic.LinkLabel(filename, presignedLinkData.resp.link).set({ - font: "link-label-12" + const filename = linkInfo.filename || osparc.file.FilePicker.getFilenameFromPath(linkInfo); + linkLabel.set({ + value: filename, + url: presignedLinkData.resp.link }); - const chipContainer = this.getChildControl("chips"); - chipContainer.remove(label); - chipContainer.add(linkLabel); } }); } @@ -529,19 +527,15 @@ qx.Class.define("osparc.workbench.NodeUI", { const portKey = link["output"]; const inputNode = this.getNode().getWorkbench().getNode(inputNodeId); if (inputNode) { - inputNode.bind("outputs", label, "value", { + inputNode.bind("outputs", linkLabel, "value", { converter: outputs => { - if (portKey in outputs && "value" in outputs[portKey]) { + if (portKey in outputs && "value" in outputs[portKey] && outputs[portKey]["value"]) { const val = outputs[portKey]["value"]; if (this.getNode().getMetaData()["key"].includes("probe/array")) { return "[" + val.join(",") + "]"; } else if (this.getNode().getMetaData()["key"].includes("probe/file")) { const filename = val.filename || osparc.file.FilePicker.getFilenameFromPath(val); - label.set({ - font: "text-12", - rich: true - }); - replaceByLinkLabel(val); + populateLinkLabel(val); return filename; } return String(val); @@ -551,7 +545,7 @@ qx.Class.define("osparc.workbench.NodeUI", { }); } } else { - label.setValue(""); + linkLabel.setValue(""); } }, From 9e0d75b7ee0a372a8d42f097ab2c0bcb7f4f48b6 Mon Sep 17 00:00:00 2001 From: Andrei Neagu <5694077+GitHK@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:31:40 +0100 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=90=9B=20removes=20unsupported=20para?= =?UTF-8?q?meter=20(#6612)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Andrei Neagu On behalf of @GitHK --- .../service-library/src/servicelib/deferred_tasks/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/service-library/src/servicelib/deferred_tasks/_utils.py b/packages/service-library/src/servicelib/deferred_tasks/_utils.py index dd71341bad6..b06c98329ad 100644 --- a/packages/service-library/src/servicelib/deferred_tasks/_utils.py +++ b/packages/service-library/src/servicelib/deferred_tasks/_utils.py @@ -30,6 +30,6 @@ async def wrapper(*args, **kwargs): f"Please check code at: '{func.__module__}.{func.__name__}'" ) _logger.exception(msg) - raise RejectMessage(reason=msg) from e + raise RejectMessage from e return wrapper From 5770ecfd5f8962683206bedb115b1e466162dec0 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:36:46 +0100 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=8E=A8=20[Frontend]=20Open=20Study=20?= =?UTF-8?q?location=20from=20Search=20context=20(#6630)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../class/osparc/dashboard/StudyBrowser.js | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 91499e44ce7..7f79e02f3b1 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -90,22 +90,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } }, - statics: { - sortFoldersList: function(foldersList, propKey) { - const sortByProperty = prop => { - return function(a, b) { - const upKey = qx.lang.String.firstUp(prop); - const getter = "get" + upKey; - if (getter in a && getter in b) { - return b[getter]() - a[getter](); - } - return 0; - }; - }; - foldersList.sort(sortByProperty(propKey || "lastModified")); - } - }, - members: { __dontShowTutorial: null, __header: null, @@ -421,11 +405,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __addNewFolderButton: function() { + if (this.getCurrentContext() !== "studiesAndFolders") { + return; + } const currentWorkspaceId = this.getCurrentWorkspaceId(); if (currentWorkspaceId) { - if (this.getCurrentContext() !== "studiesAndFolders") { - return; - } const currentWorkspace = osparc.store.Workspaces.getInstance().getWorkspace(this.getCurrentWorkspaceId()); if (currentWorkspace && !currentWorkspace.getMyAccessRights()["write"]) { // If user can't write in workspace, do not show plus button @@ -1276,6 +1260,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { menu.add(openButton); } + if (this.getCurrentContext() === "search") { + const renameStudyButton = this.__getOpenLocationMenuButton(studyData); + menu.add(renameStudyButton); + } + if (writeAccess) { const renameStudyButton = this.__getRenameStudyMenuButton(studyData); menu.add(renameStudyButton); @@ -1339,6 +1328,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { card.evaluateMenuButtons(); }, + __getOpenLocationMenuButton: function(studyData) { + const openLocationButton = new qx.ui.menu.Button(this.tr("Open location"), "@FontAwesome5Solid/external-link-alt/12"); + openLocationButton.addListener("execute", () => { + this.__changeContext("studiesAndFolders", studyData["workspaceId"], studyData["folderId"]); + }, this); + return openLocationButton; + }, + __getRenameStudyMenuButton: function(studyData) { const renameButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12"); renameButton.addListener("execute", () => { From 6db71c108d8e8ef114e6843e951406cfa592c4b7 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:32:50 +0100 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=8E=A8=20[Frontend]=20Publish=20templ?= =?UTF-8?q?ate=20UI/UX=20(#6617)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/ResourceContainerManager.js | 14 ++++++--- .../class/osparc/dashboard/StudyBrowser.js | 4 ++- .../class/osparc/service/ServiceListItem.js | 2 +- .../class/osparc/share/AddCollaborators.js | 29 ++++++++++++++----- .../osparc/share/NewCollaboratorsManager.js | 6 ++-- .../class/osparc/share/PublishTemplate.js | 3 +- 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index f066e10b56e..187f6b441d3 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -83,10 +83,12 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { statics: { sortListByPriority: function(list) { - list.getChildren().sort((a, b) => { - let sortingValue = a.getPriority() - b.getPriority(); - return sortingValue; - }); + if (list) { + list.getChildren().sort((a, b) => { + let sortingValue = a.getPriority() - b.getPriority(); + return sortingValue; + }); + } }, cardExists: function(container, newCard) { @@ -233,6 +235,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, __addCardToContainer: function(card, container) { + if (container == null) { + return; + } + container.add(card); if (this.getMode() === "list") { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 7f79e02f3b1..70a3554ae41 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -233,8 +233,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } const studies = resp["data"]; - this._resourcesContainer.getFlatList().nextRequest = resp["_links"]["next"]; this.__addStudiesToList(studies); + if (this._resourcesContainer.getFlatList()) { + this._resourcesContainer.getFlatList().nextRequest = resp["_links"]["next"]; + } // Show Quick Start if there are no studies in the root folder of the personal workspace const quickStartInfo = osparc.product.quickStart.Utils.getQuickStart(); diff --git a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js index 059dd840170..e93cf802333 100644 --- a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js +++ b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js @@ -57,7 +57,7 @@ qx.Class.define("osparc.service.ServiceListItem", { LATEST: "latest", ITEM_WIDTH: 550, ITEM_HEIGHT: 35, - SERVICE_ICON: "@FontAwesome5Solid/paw/24" + SERVICE_ICON: osparc.product.Utils.getProductThumbUrl() }, members: { diff --git a/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js b/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js index 148eead1bf9..da0394cd010 100644 --- a/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js @@ -27,11 +27,13 @@ qx.Class.define("osparc.share.AddCollaborators", { /** * @param serializedDataCopy {Object} Object containing the Serialized Data + * @param publishingTemplate {Boolean} Wether the widget needs to be initialized for publishing template */ - construct: function(serializedDataCopy) { + construct: function(serializedDataCopy, publishingTemplate = false) { this.base(arguments); - this.setSerializedData(serializedDataCopy); + this.__serializedDataCopy = serializedDataCopy; + this.__publishingTemplate = publishingTemplate; this._setLayout(new qx.ui.layout.VBox(5)); @@ -44,6 +46,7 @@ qx.Class.define("osparc.share.AddCollaborators", { members: { __serializedDataCopy: null, + __publishingTemplate: null, _createChildControlImpl: function(id) { let control; @@ -52,22 +55,31 @@ qx.Class.define("osparc.share.AddCollaborators", { control = new qx.ui.basic.Label(this.tr("Select from the list below and click Share")); this._add(control); break; + case "buttons-layout": + control = new qx.ui.container.Composite(new qx.ui.layout.HBox()); + this._add(control); + break; case "share-with": control = new qx.ui.form.Button(this.tr("Share with...")).set({ appearance: "form-button", alignX: "left", allowGrowX: false }); - this._add(control); + this.getChildControl("buttons-layout").add(control); + this.getChildControl("buttons-layout").add(new qx.ui.core.Spacer(), { + flex: 1 + }); break; - case "check-organizations": - control = new qx.ui.form.Button(this.tr("Check Organizations...")).set({ + case "my-organizations": + control = new qx.ui.form.Button(this.tr("My Organizations...")).set({ appearance: "form-button-outlined", allowGrowY: false, allowGrowX: false, + alignX: "right", icon: osparc.dashboard.CardBase.SHARED_ORGS }); - this._add(control); + this.getChildControl("buttons-layout").add(control); + break; } return control || this.base(arguments, id); }, @@ -82,13 +94,16 @@ qx.Class.define("osparc.share.AddCollaborators", { const addCollaboratorBtn = this.getChildControl("share-with"); addCollaboratorBtn.addListener("execute", () => { const collaboratorsManager = new osparc.share.NewCollaboratorsManager(this.__serializedDataCopy); + if (this.__publishingTemplate) { + collaboratorsManager.getActionButton().setLabel(this.tr("Publish for")); + } collaboratorsManager.addListener("addCollaborators", e => { collaboratorsManager.close(); this.fireDataEvent("addCollaborators", e.getData()); }, this); }, this); - const organizations = this.getChildControl("check-organizations"); + const organizations = this.getChildControl("my-organizations"); organizations.addListener("execute", () => osparc.desktop.organizations.OrganizationsWindow.openWindow(), this); } } diff --git a/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js b/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js index 148d8df6f14..65510ea9142 100644 --- a/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js +++ b/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js @@ -82,7 +82,8 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", { const buttons = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({ alignX: "right" })); - const orgsButton = this.__orgsButton = new qx.ui.form.Button(this.tr("Check Organizations...")).set({ + // Quick access for users that still don't belong to any organization + const orgsButton = this.__orgsButton = new qx.ui.form.Button(this.tr("My Organizations...")).set({ appearance: "form-button", visibility: "excluded", }); @@ -184,9 +185,6 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", { }); }, - __openOrganization: function() { - }, - __shareClicked: function() { this.__collabButtonsContainer.setEnabled(false); this.__shareButton.setFetching(true); diff --git a/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js b/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js index 6572c24a900..746d8360870 100644 --- a/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js +++ b/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js @@ -48,11 +48,12 @@ qx.Class.define("osparc.share.PublishTemplate", { __buildLayout: function() { // mark it us template, so that testers can share it with product everyone this.__potentialTemplateData["resourceType"] = "template"; - const addCollaborators = new osparc.share.AddCollaborators(this.__potentialTemplateData); + const addCollaborators = new osparc.share.AddCollaborators(this.__potentialTemplateData, true); addCollaborators.getChildControl("intro-text").set({ value: this.tr("Make the ") + osparc.product.Utils.getTemplateAlias() + this.tr(" also accessible to:"), font: "text-14" }); + addCollaborators.getChildControl("share-with").setLabel(this.tr("Publish for...")); this._add(addCollaborators); this._add(this.__selectedCollabs); From f5f61b1a7d6517d159f55f9b50e83a1bc6b83417 Mon Sep 17 00:00:00 2001 From: Sylvain <35365065+sanderegg@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:53:01 +0100 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=94=A8CI:=20disable=20uv=20caching=20?= =?UTF-8?q?(#6636)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-testing-deploy.yml | 84 ++++++++++++------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci-testing-deploy.yml b/.github/workflows/ci-testing-deploy.yml index a98872ab707..339f415ed61 100644 --- a/.github/workflows/ci-testing-deploy.yml +++ b/.github/workflows/ci-testing-deploy.yml @@ -335,7 +335,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -386,7 +386,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -431,7 +431,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -476,7 +476,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/storage/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -526,7 +526,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/agent/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -574,7 +574,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/api/tests/requirements.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -619,7 +619,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/api-server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -670,7 +670,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/autoscaling/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -718,7 +718,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/catalog/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -772,7 +772,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/clusters-keeper/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -831,7 +831,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/datcore-adapter/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -927,7 +927,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/director-v2/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -981,7 +981,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/aws-library/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1029,7 +1029,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/dask-task-models-library/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1077,7 +1077,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/dask-sidecar/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1125,7 +1125,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/osparc-gateway-server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1183,7 +1183,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/payments/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1231,7 +1231,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/dynamic-scheduler/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1279,7 +1279,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/resource-usage-tracker/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1337,7 +1337,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/dynamic-sidecar/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1385,7 +1385,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/efs-guardian/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1444,7 +1444,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/ci/helpers/requirements.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1479,7 +1479,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/postgres-database/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1527,7 +1527,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/notifications-library/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1575,7 +1575,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/service-integration/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1623,7 +1623,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/service-library/requirements/ci*.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1671,7 +1671,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/settings-library/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1719,7 +1719,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/models-library/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1770,7 +1770,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/notifications-library/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1820,7 +1820,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/simcore-sdk/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1928,7 +1928,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -1991,7 +1991,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2054,7 +2054,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/director-v2/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2121,7 +2121,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/director-v2/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2186,7 +2186,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/dynamic-sidecar/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2250,7 +2250,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/osparc-gateway-server/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2327,7 +2327,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/simcore-sdk/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2414,7 +2414,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/public-api/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2474,7 +2474,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/swarm-deploy/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2545,7 +2545,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/e2e/requirements/requirements.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash @@ -2608,7 +2608,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/e2e-playwright/requirements/ci.txt" - name: expose github runtime for buildx uses: crazy-max/ghaction-github-runtime@v3 @@ -2670,7 +2670,7 @@ jobs: uses: astral-sh/setup-uv@v3 with: version: "0.4.x" - enable-cache: true + enable-cache: false cache-dependency-glob: "**/environment-setup/requirements/ci.txt" - name: show system version run: ./ci/helpers/show_system_versions.bash From f3c6273d01e0a38e857e80527cabb3c17829663e Mon Sep 17 00:00:00 2001 From: Matus Drobuliak <60785969+matusdrobuliak66@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:08:26 +0100 Subject: [PATCH 7/8] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20rearranging=20`webserv?= =?UTF-8?q?er`=20tests=20(#6633)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/integration/02/test_computation.py | 33 +---- .../with_dbs/{03 => 01}/folders/conftest.py | 0 .../{03 => 01}/folders/test_folders.py | 0 .../test_resource_manager.py | 0 .../with_dbs/{03 => 01}/products/conftest.py | 0 .../{03 => 01}/products/test_products_db.py | 0 .../products/test_products_handlers.py | 0 .../{03 => 01}/products/test_products_rpc.py | 0 .../with_dbs/{03 => 01}/wallets/conftest.py | 0 .../{03 => 01}/wallets/payments/conftest.py | 0 .../wallets/payments/test_payments.py | 0 .../wallets/payments/test_payments_methods.py | 0 .../wallets/payments/test_payments_rpc.py | 0 .../{03 => 01}/wallets/test_wallets.py | 0 .../{03 => 01}/wallets/test_wallets_groups.py | 0 .../{03 => 01}/workspaces/conftest.py | 0 .../{03 => 01}/workspaces/test_workspaces.py | 0 ...t_workspaces__folders_and_projects_crud.py | 0 ...t_workspaces__list_projects_full_search.py | 0 ...ces__moving_projects_between_workspaces.py | 0 .../workspaces/test_workspaces_groups.py | 0 .../server/tests/unit/with_dbs/03/conftest.py | 134 +---------------- .../server/tests/unit/with_dbs/conftest.py | 140 +++++++++++++++++- 23 files changed, 140 insertions(+), 167 deletions(-) rename services/web/server/tests/unit/with_dbs/{03 => 01}/folders/conftest.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/folders/test_folders.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/garbage_collector/test_resource_manager.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/products/conftest.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/products/test_products_db.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/products/test_products_handlers.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/products/test_products_rpc.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/conftest.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/payments/conftest.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/payments/test_payments.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/payments/test_payments_methods.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/payments/test_payments_rpc.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/test_wallets.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/wallets/test_wallets_groups.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/workspaces/conftest.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/workspaces/test_workspaces.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/workspaces/test_workspaces__folders_and_projects_crud.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/workspaces/test_workspaces__list_projects_full_search.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/workspaces/test_workspaces__moving_projects_between_workspaces.py (100%) rename services/web/server/tests/unit/with_dbs/{03 => 01}/workspaces/test_workspaces_groups.py (100%) diff --git a/services/web/server/tests/integration/02/test_computation.py b/services/web/server/tests/integration/02/test_computation.py index 0a73402e68d..98cd65e511d 100644 --- a/services/web/server/tests/integration/02/test_computation.py +++ b/services/web/server/tests/integration/02/test_computation.py @@ -95,28 +95,10 @@ def __str__(self) -> str: return f"{self.__class__.__name__}({items})" -def standard_role_response(): +def user_role_response(): return ( "user_role,expected", [ - pytest.param( - UserRole.ANONYMOUS, - _ExpectedResponseTuple( - ok=status.HTTP_401_UNAUTHORIZED, - created=status.HTTP_401_UNAUTHORIZED, - no_content=status.HTTP_401_UNAUTHORIZED, - confict=status.HTTP_401_UNAUTHORIZED, - ), - ), - pytest.param( - UserRole.GUEST, - _ExpectedResponseTuple( - ok=status.HTTP_200_OK, - created=status.HTTP_201_CREATED, - no_content=status.HTTP_204_NO_CONTENT, - confict=status.HTTP_409_CONFLICT, - ), - ), pytest.param( UserRole.USER, _ExpectedResponseTuple( @@ -126,15 +108,6 @@ def standard_role_response(): confict=status.HTTP_409_CONFLICT, ), ), - pytest.param( - UserRole.TESTER, - _ExpectedResponseTuple( - ok=status.HTTP_200_OK, - created=status.HTTP_201_CREATED, - no_content=status.HTTP_204_NO_CONTENT, - confict=status.HTTP_409_CONFLICT, - ), - ), ], ) @@ -365,7 +338,7 @@ async def _assert_and_wait_for_comp_task_states_to_be_transmitted_in_projects( ) -@pytest.mark.parametrize(*standard_role_response(), ids=str) +@pytest.mark.parametrize(*user_role_response(), ids=str) async def test_start_stop_computation( client: TestClient, sleeper_service: dict[str, str], @@ -438,7 +411,7 @@ async def test_start_stop_computation( ) -@pytest.mark.parametrize(*standard_role_response(), ids=str) +@pytest.mark.parametrize(*user_role_response(), ids=str) async def test_run_pipeline_and_check_state( client: TestClient, sleeper_service: dict[str, str], diff --git a/services/web/server/tests/unit/with_dbs/03/folders/conftest.py b/services/web/server/tests/unit/with_dbs/01/folders/conftest.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/folders/conftest.py rename to services/web/server/tests/unit/with_dbs/01/folders/conftest.py diff --git a/services/web/server/tests/unit/with_dbs/03/folders/test_folders.py b/services/web/server/tests/unit/with_dbs/01/folders/test_folders.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/folders/test_folders.py rename to services/web/server/tests/unit/with_dbs/01/folders/test_folders.py diff --git a/services/web/server/tests/unit/with_dbs/03/garbage_collector/test_resource_manager.py b/services/web/server/tests/unit/with_dbs/01/garbage_collector/test_resource_manager.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/garbage_collector/test_resource_manager.py rename to services/web/server/tests/unit/with_dbs/01/garbage_collector/test_resource_manager.py diff --git a/services/web/server/tests/unit/with_dbs/03/products/conftest.py b/services/web/server/tests/unit/with_dbs/01/products/conftest.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/products/conftest.py rename to services/web/server/tests/unit/with_dbs/01/products/conftest.py diff --git a/services/web/server/tests/unit/with_dbs/03/products/test_products_db.py b/services/web/server/tests/unit/with_dbs/01/products/test_products_db.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/products/test_products_db.py rename to services/web/server/tests/unit/with_dbs/01/products/test_products_db.py diff --git a/services/web/server/tests/unit/with_dbs/03/products/test_products_handlers.py b/services/web/server/tests/unit/with_dbs/01/products/test_products_handlers.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/products/test_products_handlers.py rename to services/web/server/tests/unit/with_dbs/01/products/test_products_handlers.py diff --git a/services/web/server/tests/unit/with_dbs/03/products/test_products_rpc.py b/services/web/server/tests/unit/with_dbs/01/products/test_products_rpc.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/products/test_products_rpc.py rename to services/web/server/tests/unit/with_dbs/01/products/test_products_rpc.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/conftest.py b/services/web/server/tests/unit/with_dbs/01/wallets/conftest.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/conftest.py rename to services/web/server/tests/unit/with_dbs/01/wallets/conftest.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/payments/conftest.py b/services/web/server/tests/unit/with_dbs/01/wallets/payments/conftest.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/payments/conftest.py rename to services/web/server/tests/unit/with_dbs/01/wallets/payments/conftest.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/payments/test_payments.py b/services/web/server/tests/unit/with_dbs/01/wallets/payments/test_payments.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/payments/test_payments.py rename to services/web/server/tests/unit/with_dbs/01/wallets/payments/test_payments.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/payments/test_payments_methods.py b/services/web/server/tests/unit/with_dbs/01/wallets/payments/test_payments_methods.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/payments/test_payments_methods.py rename to services/web/server/tests/unit/with_dbs/01/wallets/payments/test_payments_methods.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/payments/test_payments_rpc.py b/services/web/server/tests/unit/with_dbs/01/wallets/payments/test_payments_rpc.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/payments/test_payments_rpc.py rename to services/web/server/tests/unit/with_dbs/01/wallets/payments/test_payments_rpc.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/test_wallets.py b/services/web/server/tests/unit/with_dbs/01/wallets/test_wallets.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/test_wallets.py rename to services/web/server/tests/unit/with_dbs/01/wallets/test_wallets.py diff --git a/services/web/server/tests/unit/with_dbs/03/wallets/test_wallets_groups.py b/services/web/server/tests/unit/with_dbs/01/wallets/test_wallets_groups.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/wallets/test_wallets_groups.py rename to services/web/server/tests/unit/with_dbs/01/wallets/test_wallets_groups.py diff --git a/services/web/server/tests/unit/with_dbs/03/workspaces/conftest.py b/services/web/server/tests/unit/with_dbs/01/workspaces/conftest.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/workspaces/conftest.py rename to services/web/server/tests/unit/with_dbs/01/workspaces/conftest.py diff --git a/services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces.py b/services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces.py rename to services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces.py diff --git a/services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces__folders_and_projects_crud.py b/services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces__folders_and_projects_crud.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces__folders_and_projects_crud.py rename to services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces__folders_and_projects_crud.py diff --git a/services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces__list_projects_full_search.py b/services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces__list_projects_full_search.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces__list_projects_full_search.py rename to services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces__list_projects_full_search.py diff --git a/services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces__moving_projects_between_workspaces.py b/services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces__moving_projects_between_workspaces.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces__moving_projects_between_workspaces.py rename to services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces__moving_projects_between_workspaces.py diff --git a/services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces_groups.py b/services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces_groups.py similarity index 100% rename from services/web/server/tests/unit/with_dbs/03/workspaces/test_workspaces_groups.py rename to services/web/server/tests/unit/with_dbs/01/workspaces/test_workspaces_groups.py diff --git a/services/web/server/tests/unit/with_dbs/03/conftest.py b/services/web/server/tests/unit/with_dbs/03/conftest.py index 8e4e8af6188..3d75d45f3dc 100644 --- a/services/web/server/tests/unit/with_dbs/03/conftest.py +++ b/services/web/server/tests/unit/with_dbs/03/conftest.py @@ -4,25 +4,11 @@ # pylint: disable=too-many-arguments -from collections.abc import AsyncIterable, AsyncIterator -from decimal import Decimal +from collections.abc import AsyncIterator import aiopg.sa import pytest -import sqlalchemy as sa -from aiopg.sa import create_engine -from aiopg.sa.connection import SAConnection -from faker import Faker -from models_library.products import ProductName -from pytest_simcore.helpers.faker_factories import random_product -from simcore_postgres_database.models.products import products -from simcore_postgres_database.models.products_prices import products_prices from simcore_postgres_database.models.user_preferences import user_preferences_frontend -from simcore_postgres_database.utils_products import get_or_create_product_group -from simcore_service_webserver.statics._constants import ( - FRONTEND_APP_DEFAULT, - FRONTEND_APPS_AVAILABLE, -) @pytest.fixture @@ -32,121 +18,3 @@ async def drop_all_preferences( yield async with aiopg_engine.acquire() as conn: await conn.execute(user_preferences_frontend.delete()) - - -@pytest.fixture -async def _pre_connection(postgres_db: sa.engine.Engine) -> AsyncIterable[SAConnection]: - # NOTE: call to postgres BEFORE app starts - async with await create_engine( - f"{postgres_db.url}" - ) as engine, engine.acquire() as conn: - yield conn - - -@pytest.fixture -async def all_products_names( - _pre_connection: SAConnection, -) -> AsyncIterable[list[ProductName]]: - # default product - result = await _pre_connection.execute( - products.select().order_by(products.c.priority) - ) - rows = await result.fetchall() - assert rows - assert len(rows) == 1 - osparc_product_row = rows[0] - assert osparc_product_row.name == FRONTEND_APP_DEFAULT - assert osparc_product_row.priority == 0 - - # creates remaing products for front-end - priority = 1 - for name in FRONTEND_APPS_AVAILABLE: - if name != FRONTEND_APP_DEFAULT: - result = await _pre_connection.execute( - products.insert().values( - random_product( - name=name, - priority=priority, - login_settings=osparc_product_row.login_settings, - group_id=None, - ) - ) - ) - await get_or_create_product_group(_pre_connection, product_name=name) - priority += 1 - - # get all products - result = await _pre_connection.execute( - sa.select(products.c.name).order_by(products.c.priority) - ) - rows = await result.fetchall() - - yield [r.name for r in rows] - - await _pre_connection.execute(products_prices.delete()) - await _pre_connection.execute( - products.delete().where(products.c.name != FRONTEND_APP_DEFAULT) - ) - - -@pytest.fixture -async def all_product_prices( - _pre_connection: SAConnection, - all_products_names: list[ProductName], - faker: Faker, -) -> dict[ProductName, Decimal | None]: - """Initial list of prices for all products""" - - # initial list of prices - product_price = { - "osparc": Decimal(0), # free of charge - "tis": Decimal(5), - "tiplite": Decimal(5), - "s4l": Decimal(9), - "s4llite": Decimal(0), # free of charge - "s4lacad": Decimal(1.1), - } - - result = {} - for product_name in all_products_names: - usd_or_none = product_price.get(product_name, None) - if usd_or_none is not None: - await _pre_connection.execute( - products_prices.insert().values( - product_name=product_name, - usd_per_credit=usd_or_none, - comment=faker.sentence(), - min_payment_amount_usd=10, - stripe_price_id=faker.pystr(), - stripe_tax_rate_id=faker.pystr(), - ) - ) - - result[product_name] = usd_or_none - - return result - - -@pytest.fixture -async def latest_osparc_price( - all_product_prices: dict[ProductName, Decimal], - _pre_connection: SAConnection, -) -> Decimal: - """This inserts a new price for osparc in the history - (i.e. the old price of osparc is still in the database) - """ - - usd = await _pre_connection.scalar( - products_prices.insert() - .values( - product_name="osparc", - usd_per_credit=all_product_prices["osparc"] + 5, - comment="New price for osparc", - stripe_price_id="stripe-price-id", - stripe_tax_rate_id="stripe-tax-rate-id", - ) - .returning(products_prices.c.usd_per_credit) - ) - assert usd is not None - assert usd != all_product_prices["osparc"] - return Decimal(usd) diff --git a/services/web/server/tests/unit/with_dbs/conftest.py b/services/web/server/tests/unit/with_dbs/conftest.py index f4f527179b1..84ffd71830f 100644 --- a/services/web/server/tests/unit/with_dbs/conftest.py +++ b/services/web/server/tests/unit/with_dbs/conftest.py @@ -17,8 +17,9 @@ import textwrap from collections.abc import AsyncIterator, Awaitable, Callable, Iterator from copy import deepcopy +from decimal import Decimal from pathlib import Path -from typing import Any, Final +from typing import Any, AsyncIterable, Final from unittest import mock from unittest.mock import AsyncMock, MagicMock @@ -34,6 +35,8 @@ import sqlalchemy as sa from aiohttp import web from aiohttp.test_utils import TestClient, TestServer +from aiopg.sa import create_engine +from aiopg.sa.connection import SAConnection from faker import Faker from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet from models_library.products import ProductName @@ -41,6 +44,7 @@ from pydantic import ByteSize, parse_obj_as from pytest_mock import MockerFixture from pytest_simcore.helpers.dict_tools import ConfigDict +from pytest_simcore.helpers.faker_factories import random_product from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict from pytest_simcore.helpers.typing_env import EnvVarsDict from pytest_simcore.helpers.webserver_login import NewUser, UserInfoDict @@ -56,7 +60,12 @@ from simcore_postgres_database.models.groups_extra_properties import ( groups_extra_properties, ) -from simcore_postgres_database.utils_products import get_default_product_name +from simcore_postgres_database.models.products import products +from simcore_postgres_database.models.products_prices import products_prices +from simcore_postgres_database.utils_products import ( + get_default_product_name, + get_or_create_product_group, +) from simcore_service_webserver._constants import INDEX_RESOURCE_NAME from simcore_service_webserver.application import create_application from simcore_service_webserver.db.plugin import get_database_engine @@ -67,6 +76,10 @@ list_user_groups_with_read_access, ) from simcore_service_webserver.projects.models import ProjectDict +from simcore_service_webserver.statics._constants import ( + FRONTEND_APP_DEFAULT, + FRONTEND_APPS_AVAILABLE, +) from sqlalchemy import exc as sql_exceptions CURRENT_DIR = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent @@ -529,8 +542,6 @@ def postgres_db( @pytest.fixture async def aiopg_engine(postgres_db: sa.engine.Engine) -> AsyncIterator[aiopg.sa.Engine]: - from aiopg.sa import create_engine - engine = await create_engine(f"{postgres_db.url}") assert engine @@ -762,3 +773,124 @@ async def with_permitted_override_services_specifications( .where(groups_extra_properties.c.group_id == 1) .values(override_services_specifications=old_value) ) + + +# PRODUCT PRICES FIXTURES ------------------------------------------------------- + + +@pytest.fixture +async def _pre_connection(postgres_db: sa.engine.Engine) -> AsyncIterable[SAConnection]: + # NOTE: call to postgres BEFORE app starts + async with await create_engine( + f"{postgres_db.url}" + ) as engine, engine.acquire() as conn: + yield conn + + +@pytest.fixture +async def all_products_names( + _pre_connection: SAConnection, +) -> AsyncIterable[list[ProductName]]: + # default product + result = await _pre_connection.execute( + products.select().order_by(products.c.priority) + ) + rows = await result.fetchall() + assert rows + assert len(rows) == 1 + osparc_product_row = rows[0] + assert osparc_product_row.name == FRONTEND_APP_DEFAULT + assert osparc_product_row.priority == 0 + + # creates remaing products for front-end + priority = 1 + for name in FRONTEND_APPS_AVAILABLE: + if name != FRONTEND_APP_DEFAULT: + result = await _pre_connection.execute( + products.insert().values( + random_product( + name=name, + priority=priority, + login_settings=osparc_product_row.login_settings, + group_id=None, + ) + ) + ) + await get_or_create_product_group(_pre_connection, product_name=name) + priority += 1 + + # get all products + result = await _pre_connection.execute( + sa.select(products.c.name).order_by(products.c.priority) + ) + rows = await result.fetchall() + + yield [r.name for r in rows] + + await _pre_connection.execute(products_prices.delete()) + await _pre_connection.execute( + products.delete().where(products.c.name != FRONTEND_APP_DEFAULT) + ) + + +@pytest.fixture +async def all_product_prices( + _pre_connection: SAConnection, + all_products_names: list[ProductName], + faker: Faker, +) -> dict[ProductName, Decimal | None]: + """Initial list of prices for all products""" + + # initial list of prices + product_price = { + "osparc": Decimal(0), # free of charge + "tis": Decimal(5), + "tiplite": Decimal(5), + "s4l": Decimal(9), + "s4llite": Decimal(0), # free of charge + "s4lacad": Decimal(1.1), + } + + result = {} + for product_name in all_products_names: + usd_or_none = product_price.get(product_name, None) + if usd_or_none is not None: + await _pre_connection.execute( + products_prices.insert().values( + product_name=product_name, + usd_per_credit=usd_or_none, + comment=faker.sentence(), + min_payment_amount_usd=10, + stripe_price_id=faker.pystr(), + stripe_tax_rate_id=faker.pystr(), + ) + ) + + result[product_name] = usd_or_none + + return result + + +@pytest.fixture +async def latest_osparc_price( + all_product_prices: dict[ProductName, Decimal], + _pre_connection: SAConnection, +) -> Decimal: + """This inserts a new price for osparc in the history + (i.e. the old price of osparc is still in the database) + """ + + usd = await _pre_connection.scalar( + products_prices.insert() + .values( + product_name="osparc", + usd_per_credit=all_product_prices["osparc"] + 5, + comment="New price for osparc", + stripe_price_id="stripe-price-id", + stripe_tax_rate_id="stripe-tax-rate-id", + ) + .returning(products_prices.c.usd_per_credit) + ) + assert usd is not None + assert usd != all_product_prices["osparc"] + return Decimal(usd) From 10679246c12b99013a4551d1b677354b906ff46e Mon Sep 17 00:00:00 2001 From: Sylvain <35365065+sanderegg@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:12:33 +0100 Subject: [PATCH 8/8] Bugfix: notification library with invalid pip cache --- .github/workflows/ci-testing-deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-testing-deploy.yml b/.github/workflows/ci-testing-deploy.yml index 339f415ed61..38163963d6d 100644 --- a/.github/workflows/ci-testing-deploy.yml +++ b/.github/workflows/ci-testing-deploy.yml @@ -1764,8 +1764,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - cache: "pip" - cache-dependency-path: "packages/notifications-library/requirements/ci.txt" - name: install uv uses: astral-sh/setup-uv@v3 with: