Skip to content

Commit

Permalink
Merge branch 'master' into fix/load-folders-after-back
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Oct 16, 2024
2 parents 46210c4 + 33237ba commit 799bf59
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import binascii
from typing import Final

DEFAULT_SESSION_COOKIE_NAME: Final[str] = "osparc-sc"
DEFAULT_SESSION_COOKIE_NAME: Final[str] = "osparc-sc2"
_32_BYTES_LENGTH: Final[int] = 32


Expand Down
7 changes: 2 additions & 5 deletions services/api-server/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,9 @@ fastapi==0.99.1
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/service-library/requirements/_fastapi.in
# -r requirements/_base.in
# fastapi-pagination
# prometheus-fastapi-instrumentator
fastapi-pagination==0.12.17
# via
# -c requirements/./constraints.txt
# -r requirements/_base.in
fastapi-pagination==0.12.31
# via -r requirements/_base.in
faststream==0.5.10
# via
# -r requirements/../../../packages/service-library/requirements/_base.in
Expand Down
28 changes: 0 additions & 28 deletions services/api-server/requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,3 @@ aws-sam-translator<1.56.0
# # aws-sam-translator<1.55.0 (from -c ./constraints.txt (line 32))
# # aws-sam-translator>=1.57.0 (from cfn-lint==0.72.10->-c ./constraints.txt (line 33))
cfn-lint<0.72.1



#
# .venv/lib/python3.10/site-packages/fastapi_pagination/api.py:352: in _update_route
# get_parameterless_sub_dependant(
# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:136: in get_parameterless_sub_dependant
# return get_sub_dependant(depends=depends, dependency=depends.dependency, path=path)
# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:159: in get_sub_dependant
# sub_dependant = get_dependant(
# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:310: in get_dependant
# sub_dependant = get_param_sub_dependant(
# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:123: in get_param_sub_dependant
# return get_sub_dependant(
# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:159: in get_sub_dependant
# sub_dependant = get_dependant(
# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:331: in get_dependant
# add_param_to_fields(field=param_field, dependant=dependant)
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

# def add_param_to_fields(*, field: ModelField, dependant: Dependant) -> None:
# field_info = cast(params.Param, field.field_info)
# > if field_info.in_ == params.ParamTypes.path:
# E AttributeError: 'FieldInfo' object has no attribute 'in_'

# .venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py:500: AttributeError

fastapi-pagination<=0.12.17
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,36 @@
from collections.abc import Sequence
from typing import Any, ClassVar, Generic, TypeAlias, TypeVar

from fastapi_pagination.limit_offset import LimitOffsetParams
from fastapi_pagination.links.limit_offset import (
LimitOffsetPage as _FastApiLimitOffsetPage,
)
from fastapi import Query
from fastapi_pagination.customization import CustomizedPage, UseName, UseParamsFields
from fastapi_pagination.limit_offset import LimitOffsetParams as _LimitOffsetParams
from fastapi_pagination.links import LimitOffsetPage as _LimitOffsetPage
from models_library.rest_pagination import (
DEFAULT_NUMBER_OF_ITEMS_PER_PAGE,
MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE,
)
from models_library.utils.pydantic_tools_extension import FieldNotRequired
from pydantic import Field, NonNegativeInt, validator
from pydantic import NonNegativeInt, validator
from pydantic.generics import GenericModel

T = TypeVar("T")

# NOTE: same pagination limits and defaults as web-server
Page = _FastApiLimitOffsetPage.with_custom_options(
limit=Field(
DEFAULT_NUMBER_OF_ITEMS_PER_PAGE, ge=1, le=MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE
)
)
# NOTE: Renamed to make shorter clients name models
Page.__name__ = "Page"

PaginationParams: TypeAlias = LimitOffsetParams
Page = CustomizedPage[
_LimitOffsetPage[T],
# Customizes the default and maximum to fit those of the web-server. It simplifies interconnection
UseParamsFields(
limit=Query(
DEFAULT_NUMBER_OF_ITEMS_PER_PAGE,
ge=1,
le=MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE,
description="Page size limit",
)
),
# Renames class for the openapi.json to make the python-client's name models shorter
UseName(name="Page"),
]

PaginationParams: TypeAlias = _LimitOffsetParams


class OnePage(GenericModel, Generic[T]):
Expand Down
2 changes: 1 addition & 1 deletion services/docker-compose-dev-vendors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
# auth: https://doc.traefik.io/traefik/middlewares/http/forwardauth
- traefik.http.middlewares.${SWARM_STACK_NAME}_manual-auth.forwardauth.address=http://${WEBSERVER_HOST}:${WEBSERVER_PORT}/v0/auth:check
- traefik.http.middlewares.${SWARM_STACK_NAME}_manual-auth.forwardauth.trustForwardHeader=true
- traefik.http.middlewares.${SWARM_STACK_NAME}_manual-auth.forwardauth.authResponseHeaders=Set-Cookie,osparc-sc
- traefik.http.middlewares.${SWARM_STACK_NAME}_manual-auth.forwardauth.authResponseHeaders=Set-Cookie,osparc-sc2
# routing
- traefik.http.services.${SWARM_STACK_NAME}_manual.loadbalancer.server.port=80
- traefik.http.services.${SWARM_STACK_NAME}_manual.loadbalancer.healthcheck.path=/
Expand Down
2 changes: 2 additions & 0 deletions services/docker-compose.devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ services:
volumes:
- ./efs-guardian:/devel/services/efs-guardian
- ../packages:/devel/packages
deploy:
replicas: 0

static-webserver:
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ qx.Class.define("osparc.data.model.Node", {
outputs: {
check: "Object",
nullable: false,
event: "changeOutputs"
event: "changeOutputs",
apply: "__applyOutputs",
},

status: {
Expand Down Expand Up @@ -166,6 +167,12 @@ qx.Class.define("osparc.data.model.Node", {
apply: "__applyPropsForm"
},

outputsForm: {
check: "osparc.widget.NodeOutputs",
init: null,
nullable: true
},

marker: {
check: "qx.core.Object",
init: null,
Expand Down Expand Up @@ -612,6 +619,13 @@ qx.Class.define("osparc.data.model.Node", {
}, this);
},

__applyOutputs: function() {
if (!this.isPropertyInitialized("outputsForm") || !this.getOutputsForm()) {
const nodeOutputs = new osparc.widget.NodeOutputs(this);
this.setOutputsForm(nodeOutputs);
}
},

removeNodePortConnections: function(inputNodeId) {
let inputs = this.__getInputData();
for (const portId in inputs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.__listenToNoMoreCreditsEvents();
this.__listenToEvent();
this.__listenToServiceStatus();
this.__listenToStateInputPorts();
},

__listenToLogger: function() {
Expand Down Expand Up @@ -435,6 +436,85 @@ qx.Class.define("osparc.desktop.StudyEditor", {
}
},

__listenToStateInputPorts: function() {
const socket = osparc.wrapper.WebSocket.getInstance();
if (!socket.slotExists("stateInputPorts")) {
socket.on("stateInputPorts", data => {
this.__statePortReceived(data, "stateInputPorts");
}, this);
}
if (!socket.slotExists("stateOutputPorts")) {
socket.on("stateOutputPorts", data => {
this.__statePortReceived(data, "stateOutputPorts");
}, this);
}
},

__statePortReceived: function(socketData, msgName) {
const studyId = socketData["project_id"];
if (this.getStudy().getUuid() !== studyId) {
return;
}

const nodeId = socketData["node_id"];
const workbench = this.getStudy().getWorkbench();
const node = workbench.getNode(nodeId);
if (!node) {
if (osparc.data.Permissions.getInstance().isTester()) {
console.log("Ignored ws 'stateInputPorts' msg", socketData);
}
return;
}

const propsForm = node.getPropsForm();
if (msgName === "stateInputPorts" && propsForm) {
const portId = socketData["port_key"];
const status = socketData["status"];
switch (status) {
case "DOWNLOAD_STARTED":
propsForm.retrievingPortData(
portId,
osparc.form.renderer.PropForm.RETRIEVE_STATUS.downloading
);
break;
case "DOWNLOAD_FINISHED_SUCCESSFULLY":
propsForm.retrievedPortData(portId, true);
break;
case "DOWNLOAD_WAS_ABORTED":
case "DOWNLOAD_FINISHED_WITH_ERROR":
propsForm.retrievedPortData(portId, false);
break;
}
}

const outputsForm = node.getOutputsForm();
if (msgName === "stateOutputPorts" && outputsForm) {
const portId = socketData["port_key"];
const status = socketData["status"];
switch (status) {
case "UPLOAD_STARTED":
outputsForm.setRetrievingStatus(
portId,
osparc.form.renderer.PropForm.RETRIEVE_STATUS.uploading
);
break;
case "UPLOAD_FINISHED_SUCCESSFULLY":
outputsForm.setRetrievingStatus(
portId,
osparc.form.renderer.PropForm.RETRIEVE_STATUS.succeed
);
break;
case "UPLOAD_WAS_ABORTED":
case "UPLOAD_FINISHED_WITH_ERROR":
outputsForm.setRetrievingStatus(
portId,
osparc.form.renderer.PropForm.RETRIEVE_STATUS.failed
);
break;
}
}
},

__reloadSnapshotsAndIterations: function() {
const isVCDisabled = osparc.utils.DisabledPlugins.isVersionControlDisabled();
if (!isVCDisabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,12 @@ qx.Class.define("osparc.desktop.WorkbenchView", {

// OUTPUTS
const outputsBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(spacing));
if (node.hasOutputs()) {
const nodeOutputs = new osparc.widget.NodeOutputs(node, node.getMetaData().outputs).set({
const outputsForm = node.getOutputsForm();
if (node.hasOutputs() && outputsForm) {
outputsForm.set({
offerProbes: true
});
outputsBox.add(nodeOutputs);
outputsBox.add(outputsForm);
}

const nodeFilesBtn = new qx.ui.form.Button(this.tr("Service data"), "@FontAwesome5Solid/folder-open/14").set({
Expand Down
Loading

0 comments on commit 799bf59

Please sign in to comment.