Skip to content

Commit 71ee6c3

Browse files
committed
allow to patch inputs and outputs of function jobs
1 parent 4b420b4 commit 71ee6c3

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

packages/models-library/src/models_library/functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ class RegisteredProjectFunctionJobPatch(BaseModel):
179179
function_class: Literal[FunctionClass.PROJECT] = FunctionClass.PROJECT
180180
title: str | None
181181
description: str | None
182+
inputs: FunctionInputs
183+
outputs: FunctionOutputs
182184
project_job_id: ProjectID | None
183185
job_creation_task_id: TaskID | None
184186

@@ -197,6 +199,8 @@ class RegisteredSolverFunctionJobPatch(BaseModel):
197199
function_class: Literal[FunctionClass.SOLVER] = FunctionClass.SOLVER
198200
title: str | None
199201
description: str | None
202+
inputs: FunctionInputs
203+
outputs: FunctionOutputs
200204
solver_job_id: ProjectID | None
201205
job_creation_task_id: TaskID | None
202206

@@ -212,6 +216,8 @@ class RegisteredPythonCodeFunctionJob(PythonCodeFunctionJob, RegisteredFunctionJ
212216
class RegisteredPythonCodeFunctionJobPatch(BaseModel):
213217
function_class: Literal[FunctionClass.PYTHON_CODE] = FunctionClass.PYTHON_CODE
214218
title: str | None
219+
inputs: FunctionInputs
220+
outputs: FunctionOutputs
215221
description: str | None
216222

217223

services/web/server/src/simcore_service_webserver/functions/_functions_service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,8 @@ def _patch_functionjob(
802802
title=patch.title or function_job_db.title,
803803
uuid=function_job_db.uuid,
804804
description=patch.description or function_job_db.description,
805-
inputs=function_job_db.inputs,
806-
outputs=function_job_db.outputs,
805+
inputs=patch.inputs or function_job_db.inputs,
806+
outputs=patch.outputs or function_job_db.outputs,
807807
created=function_job_db.created,
808808
class_specific_data=FunctionClassSpecificData(
809809
project_job_id=(
@@ -826,8 +826,8 @@ def _patch_functionjob(
826826
title=patch.title or function_job_db.title,
827827
uuid=function_job_db.uuid,
828828
description=patch.description or function_job_db.description,
829-
inputs=function_job_db.inputs,
830-
outputs=function_job_db.outputs,
829+
inputs=patch.inputs or function_job_db.inputs,
830+
outputs=patch.outputs or function_job_db.outputs,
831831
created=function_job_db.created,
832832
class_specific_data=FunctionClassSpecificData(
833833
solver_job_id=(
@@ -850,8 +850,8 @@ def _patch_functionjob(
850850
title=patch.title or function_job_db.title,
851851
uuid=function_job_db.uuid,
852852
description=patch.description or function_job_db.description,
853-
inputs=function_job_db.inputs,
854-
outputs=function_job_db.outputs,
853+
inputs=patch.inputs or function_job_db.inputs,
854+
outputs=patch.outputs or function_job_db.outputs,
855855
created=function_job_db.created,
856856
class_specific_data=function_job_db.class_specific_data,
857857
)

services/web/server/tests/unit/with_dbs/04/functions/test_function_jobs_controller_rpc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ async def test_patch_registered_function_jobs(
464464
title="Test Function Job",
465465
description="A test function job",
466466
project_job_id=None,
467-
inputs={"input1": _faker.pyint(min_value=0, max_value=1000)},
468-
outputs={"output1": "result1"},
467+
inputs=None,
468+
outputs=None,
469469
job_creation_task_id=None,
470470
)
471471

@@ -482,6 +482,8 @@ async def test_patch_registered_function_jobs(
482482
description=_faker.sentence(),
483483
project_job_id=ProjectID(_faker.uuid4()),
484484
job_creation_task_id=TaskID(_faker.uuid4()),
485+
inputs={"input1": _faker.pyint(min_value=0, max_value=1000)},
486+
outputs={"output1": _faker.word()},
485487
)
486488

487489
registered_job = await functions_rpc.patch_registered_function_job(
@@ -494,6 +496,8 @@ async def test_patch_registered_function_jobs(
494496
assert registered_job.function_class == FunctionClass.PROJECT
495497
assert registered_job.title == patch.title
496498
assert registered_job.description == patch.description
499+
assert registered_job.inputs == patch.inputs
500+
assert registered_job.outputs == patch.outputs
497501
assert registered_job.job_creation_task_id == patch.job_creation_task_id
498502
assert registered_job.project_job_id == patch.project_job_id
499503

0 commit comments

Comments
 (0)