Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions services/api-server/openapi.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"openapi": "3.1.0",
"info": {
Expand Down Expand Up @@ -7604,6 +7604,42 @@
"format": "uuid",
"title": "Function Id"
}
},
{
"name": "x-simcore-parent-project-uuid",
"in": "header",
"required": true,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"const": "null",
"type": "string"
}
],
"title": "X-Simcore-Parent-Project-Uuid"
}
},
{
"name": "x-simcore-parent-node-id",
"in": "header",
"required": true,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"const": "null",
"type": "string"
}
],
"title": "X-Simcore-Parent-Node-Id"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -7700,6 +7736,42 @@
"format": "uuid",
"title": "Function Id"
}
},
{
"name": "x-simcore-parent-project-uuid",
"in": "header",
"required": true,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"const": "null",
"type": "string"
}
],
"title": "X-Simcore-Parent-Project-Uuid"
}
},
{
"name": "x-simcore-parent-node-id",
"in": "header",
"required": true,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"const": "null",
"type": "string"
}
],
"title": "X-Simcore-Parent-Node-Id"
}
}
],
"requestBody": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# pylint: disable=too-many-positional-arguments
from collections.abc import Callable
from typing import Annotated, Final
from typing import Annotated, Final, Literal

import jsonschema
from fastapi import APIRouter, Depends, Request, status
from fastapi import APIRouter, Depends, Header, Request, status
from fastapi_pagination.api import create_page
from jsonschema import ValidationError
from models_library.api_schemas_api_server.functions import (
Expand All @@ -29,6 +30,8 @@
UnsupportedFunctionClassError,
)
from models_library.products import ProductName
from models_library.projects import ProjectID
from models_library.projects_nodes_io import NodeID
from models_library.projects_state import RunningState
from models_library.users import UserID
from servicelib.fastapi.dependencies import get_reverse_url_mapper
Expand Down Expand Up @@ -372,8 +375,21 @@ async def run_function( # noqa: PLR0913
product_name: Annotated[str, Depends(get_product_name)],
solver_service: Annotated[SolverService, Depends(get_solver_service)],
job_service: Annotated[JobService, Depends(get_job_service)],
x_simcore_parent_project_uuid: Annotated[ProjectID | Literal["null"], Header()],
x_simcore_parent_node_id: Annotated[NodeID | Literal["null"], Header()],
) -> RegisteredFunctionJob:

parent_project_uuid = (
x_simcore_parent_project_uuid
if isinstance(x_simcore_parent_project_uuid, ProjectID)
else None
)
parent_node_id = (
x_simcore_parent_node_id
if isinstance(x_simcore_parent_node_id, NodeID)
else None
)

# Make sure the user is allowed to execute any function
# (read/write right is checked in the other endpoint called in this method)
user_api_access_rights = await wb_api_rpc.get_functions_user_api_access_rights(
Expand Down Expand Up @@ -443,8 +459,8 @@ async def run_function( # noqa: PLR0913
webserver_api=webserver_api,
wb_api_rpc=wb_api_rpc,
url_for=url_for,
x_simcore_parent_project_uuid=None,
x_simcore_parent_node_id=None,
x_simcore_parent_project_uuid=parent_project_uuid,
x_simcore_parent_node_id=parent_node_id,
user_id=user_id,
product_name=product_name,
)
Expand Down Expand Up @@ -478,8 +494,8 @@ async def run_function( # noqa: PLR0913
solver_service=solver_service,
job_service=job_service,
url_for=url_for,
x_simcore_parent_project_uuid=None,
x_simcore_parent_node_id=None,
x_simcore_parent_project_uuid=parent_project_uuid,
x_simcore_parent_node_id=parent_node_id,
)
await solvers_jobs.start_job(
request=request,
Expand Down Expand Up @@ -558,6 +574,8 @@ async def map_function( # noqa: PLR0913
product_name: Annotated[str, Depends(get_product_name)],
solver_service: Annotated[SolverService, Depends(get_solver_service)],
job_service: Annotated[JobService, Depends(get_job_service)],
x_simcore_parent_project_uuid: Annotated[ProjectID | Literal["null"], Header()],
x_simcore_parent_node_id: Annotated[NodeID | Literal["null"], Header()],
) -> RegisteredFunctionJobCollection:
function_jobs = []
function_jobs = [
Expand All @@ -573,6 +591,8 @@ async def map_function( # noqa: PLR0913
request=request,
solver_service=solver_service,
job_service=job_service,
x_simcore_parent_project_uuid=x_simcore_parent_project_uuid,
x_simcore_parent_node_id=x_simcore_parent_node_id,
)
for function_inputs in function_inputs_list
]
Expand Down
Loading
Loading